3 ms·
> Make sure you review your own code changes The author says he reviews himself on a GitLab MR / GitHub PL, I rely on two things for this: - git add -p, which
by jraph 2y ago
> Make sure you review your own code changes
The author says he reviews himself on a GitLab MR / GitHub PL, I rely on two things for this:
- git add -p, which also helps me split stuff in several commits if needed. It bothers me that it doesn't work for new files.
- git difftool dir-diff for changes with several commits
I like that it would work on any git hosting, and that it works locally. And that I can just amend my commits if I see something.
- JNRowe 2y ago`git add -p` can also work for new files, it just requires you to call `git add --intent-to-add` first. After using -N/--intent-to-add you'll see that the file is registered in the status output, and -p will work exactly how like you expect. I often find myself spiking things then breaking them back down with -N and repeated `git commit -p` to form a reasonable history. The workflow seems to really suit my mind. However, it does require some testing vigilance if you're manually editing the hunks for clarity on top of simply splitting them up.
- ydant 2y agoThanks for the hint about `--intent-to-add` / `-N`. There's constantly new things to learn about git. I use `git add -p` extensively, but never thought to check for an option like that.
- arcanemachiner 2y ago> - git add -p, which also helps me split stuff in several commits if needed. It bothers me that it doesn't work for new files. Lazygit is an amazing tool that can definitely do this (and many other useful things).
- deleted 2y ago[deleted]