Re:Fortunately, I don't squash my commits
by takeda on Monday October 05, 2020 @11:46AM
(#24688776)
Same here, I especially love `git rebase -i <base>` it opens an editor and I have an option to edit specific commits, reword the commit, squash multiple commits together (don't use this one often) or do fixup (which basically merges commit to the previous one)
[ Parent
| on HN ]
Re:Fortunately, I don't squash my commits
by sixstringtheory on Monday October 05, 2020 @12:04PM
(#24688958)
If you haven’t yet, check out rebase’s --autosquash option, along with git commit --fixup or the commit message directives “fixup!” and “squash!”
I just learned about that recently, but haven't been able to put it in practice yet. The problem I encounter is having to specify which commit to fixup to when calling `--fixup`, which I think means having to look at my commit history. Instead, my process so far includes just describing the commit I want to fixup in my commit message, in a way that makes sense to me when I'm going through the interactive rebase.
Do you have a good way to deal with this?
Re:Fortunately, I don't squash my commits
by sixstringtheory on Tuesday October 06, 2020 @12:53AM
(#24694803)
Unfortunately the best way I’ve found is pulling up the log to copy either the commit hash for --fixup, or the message for fixup!/squash!
My one liner for viewing the git log is: git log --oneline --all --decorate [--graph]
I haven't tried, but I bet HEAD~n works for --fixup, or some quick rev-parse magic (which I don’t know much of).
Yes, that's exactly my process. In fact, I'm not even sure if I could predict what would happen when calling rebase without `-i`. Basically, my shell just autocompletes "git reb" to "git rebase -i origin/master".
Re:Fortunately, I don't squash my commits
by corytheboyd on Monday October 05, 2020 @11:50AM
(#24688818)
Interactive rebase is the only way I do this now too, it’s so intuitive!