Update: as I suspected, this is a stupid exercise in wheel-reinventing, and I could've done git commit --fixup=<commitish>
all along. Thanks, Mudge.
For interactive rebase and autosquash background, see here.
All this helper does is construct commit messages that will be picked up by autosquash, using a commitish reference so you don't have to do the message yourself. If we know we have some changes that should've gone in the commit before last, and we don't want to add to its commit message, our workflow is now:
- make changes
- stage changes
$ fixup HEAD^
$ git rebase -i --autosquash
when ready
We can now happily commit fixup changes and carry on working, then do one honking great git rebase -i
before pushing, without having to remember what fix goes with what original commit.
I fully expect to have duplicated an already-existing piece of git functionality here, and await brickbats.