Description
This was already discussed briefly on the Git mailing list: https://public-inbox.org/git/alpine.DEB.2.21.1.1710151754070.40514@virtualbox/
In short, the reword! semantics are relatively easy in my mind: it would be called as
git commit --reword <commit>
would take staged changes (if any), otherwise implicitly --allow-empty,
then create a commit message to be edited in this style:
reword! <original-oneline>
<original-oneline>
<original-body>
This would be presented to the user in an editor (similar to git commit --amend
).
Upon rebase --autosquash, it would work like a squash! but comment out all
previous commit messages, and also comment out the reword! line and the
empty line after that.
In case of multiple reword!, the last one would win, and it would
naturally integrate in any fixup!/squash! workflow.
What is more difficult is something else I frequently need: drop!
. That is, I want to explicitly mark a commit to be excluded in
subsequent rebase --autosquash. I guess the best way would be to
implement a
git revert --drop <commit>
that would work as if you called git revert -n <commit> && git commit -m 'drop! '"$(git show -s --oneline <commit>)", and upon rebase --autosquash, it would reorder like fixup!/squash!/reword!, replace the
pickof the previous line (if it was a
pick) by
dropand comment out the current
pick drop! ` line.
The reason why the semantics are more difficult in that case is that drop!
does not mix well with fixup!/squash!/reword!.