4 ms·
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
by takeda 6y ago
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)
- corytheboyd 6y agoInteractive rebase is the only way I do this now too, it’s so intuitive!
- seba_dos1 6y agoI believe that if you don't know interactive rebase, you don't know git ;) Especially "git rebase -i -r" is an incredible tool.
- sixstringtheory 6y agoIf you haven’t yet, check out rebase’s --autosquash option, along with git commit --fixup or the commit message directives “fixup!” and “squash!”
- Vinnl 6y agoI 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?
- sixstringtheory 6y agoUnfortunately 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).
- Vinnl 6y agoYes, 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".