It is no secret that i’m a fan of interactive git rebase. It gives me the power to clean up the numerous small intermediate commits that i did so frequently while in the course of completing a feature (or bugfix). In the process, i usually do quite abit of squashing, reshuffling & rewording, such that the eventual commits i push upstream are well-organized & each commit is meaningful to the rest of the team.
Usually i use pick
& squash
to achieve the compressing of different
commits. Recently, my coworker showed me an alternative, which uses reword
& fixup
. Here’s how it can be done:
1
|
|
Instead of doing:
1 2 3 4 |
|
Do this:
1 2 3 4 |
|
Of course, the 2 approaches are different:
reword
&fixup
, u get to either keep the 1st commit message, or rephrase itpick
&squash
, u have more choices ~ from keeping all of the various commit messages, to writing a brand new message
For me, i almost always want the effect of reword
& fixup
.