Use git commit --amend -am "message goes here"
(or --amend -a
—usually the previous commit message is a good starting point—or even just --amend
after manually adding, etc). The --amend
takes this git commit history:
...-o-X-Y <-- branch
and in effect does a "soft reset" to make the label branch
point to X
so that the new commit's parent is again X
, resulting in this commit history:
Y [no label, but still in reflog as branch@{1}]
/
...-o-X-Z <-- branch
When you do your commit-and-rebase you get, first:
...-o-X-Y-Z <-- branch
(the new commit), then:
Y-Z [no label, but still in reflog as usual]
/
...-o-X-Z' <-- branch
where Z'
is the squash-commit of Y
and Z
. So these are different, but for your purposes, probably equally useful.