Follow

The way we do code review is fluid and perpetually changing. I've updated my list of good code review practices to reflect this day.

nikoheikkila.fi/blog/being-a-g

· · Web · 1 · 0 · 1

TL;DR: Five important points in my blog.

💎 Get your code reviewed while it's hot. Don't waste time fiddling with pull requests and online tools.

💎 Work in bite-size batches and use micro-commits to make changes digestible.

💎 Invite the right people around for review (or the whole team).

💎 Don't control people, mentor them.

💎 Let go of your ego, and trust the code to be improved in the future.

@nikoheikkila I really need to learn how to manage git better to improve on the second point.

@Ninmi Analogy of playing video games helped me to understand commits. Every time I'm safe (e.g. tests pass), it's time to save the game (git commit). If I screw things up, it's time to load (git checkout).

@nikoheikkila I just end up doing a lot of changes unrelated to each other and I just need to learn how to separate said changes (often within the same file) in to separate commits. I'm suree that's possible.

@Ninmi There's `git add -p` to help with that, but visual GUI tools and IDEs allow to select a range of lines and stage it individually.

@clacke @Ninmi Also, Sublime Merge is quite good tool (and having to pay $99 for a dark mode is some genious marketing).

@nikoheikkila @clacke I don't want Sublime for multiple reasons, but I've understood that Fugitive can accomplish what I'm after so maybe learning that is on today's agenda.
Learning how to use partial add together with interactive rebasing to edit commits helps you just move forward while coding without worrying too much about isolating changes in the heat of the moment, if that's something that would be distracting.

I sometimes make clean commits the first time, sometimes defer cleanup to later, it depends.
git config --global alias.rbi 'rebase --interactive --autosquash --rebase-merges' because I do that a dozen times a day.
@Ninmi @nikoheikkila A key point is to became good enough at interactive rebasing that you can make frequent commits while working on the code and then relatively effortlessly rework it to a helpful narrative once you've reached your destination.

@clacke @Ninmi Yup, nowadays I mainly reword commit messages through interactive rebasing. Rarely I need to squash things together unless I've forgotten to add something (most of the time `git commit --amend --no-edit` is enough).

@nikoheikkila @Ninmi git config --global alias.amend 'commit --amend --no-edit'

Indeed.
git commit --fixup together with git rebase --autosquash is immensely useful too as a "retroactive amend".
Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!