chmod +x
this file and save it as git-squash
in /usr/local/bin, then use git squash
while in a feature branch. This saves you the trouble of figuring out the correct references for the rebase which I find tedious. Note that this will automatically pick the tip of master
as the reference for the rebase, so make sure that's where you want it to be.
During the rebase I generally mark the first commit as reword
and the rest as fixup
and give that first commit the log I want the feature to have. If I need to add any further commits, e.g. fixups that are raised during code review, I add those with git commit --fixup <ref>
. Then on the next git squash
, those will be automatically marked as fixup
s.