Re:Ask HN: What is your Git commit/push flow?
by kjeetgill on Thursday March 17, 2022 @02:35PM
(#30714428)
If you're a vim guy, I use `git difftool` setup with `vimdiff` for this. Let's say you have your changes in a branch CHANGES on top of public branch PUBLIC.
1. I `git checkout PUBLIC -b CLEANUP` to a new branch.
2. Do a `git difftool CHANGES`, which opens each changed file in vimdiff one at a time.
3. For each file, I use :diffput/:diffget or just edit in changes I want.
4. Commit these changes on the CLEANUP branch.
5. Use `git difftool CHANGES` again to see the remaining diff.
6. Repeat until the diff comes back empty!
My unstructured changes tend to contain a handful of small typo fixes, white spacing, localized refactors, and 1 or 2 larger refactors and a behavioral change. Once they're all broken out, It's usually easy enough to use `git rebase -i` and reorder the smaller changes first, put out PRs for just those first, etc.
1. I `git checkout PUBLIC -b CLEANUP` to a new branch.
2. Do a `git difftool CHANGES`, which opens each changed file in vimdiff one at a time.
3. For each file, I use :diffput/:diffget or just edit in changes I want.
4. Commit these changes on the CLEANUP branch.
5. Use `git difftool CHANGES` again to see the remaining diff.
6. Repeat until the diff comes back empty!
My unstructured changes tend to contain a handful of small typo fixes, white spacing, localized refactors, and 1 or 2 larger refactors and a behavioral change. Once they're all broken out, It's usually easy enough to use `git rebase -i` and reorder the smaller changes first, put out PRs for just those first, etc.