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.


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.

Β· Β· Web Β· 1 Β· 0 Β· 0
@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).

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!