-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for drop!/reword! commits to git rebase -i
#259
Comments
Has this project already been taken up or is still available to be worked upon? |
I am unaware of any effort so far, so go right ahead! |
Correct me if I'm wrong , currently even if we try and skip a single commit in git rebase -i it gets squashed, without it been shown in th editor. |
If I understand your question right, you're asking whether |
The drop! semantics if executed properly will be a very good thing to use! This surely will be an interesting project to do! |
I've got some patches that implement the reword! part of this as amend! They need a little work - adding documentation, checking the test coverage and adjusting them to accommodate the recent changes to handling empty commits if anyone wants to pick them up |
Do we need to actually do the revert? - If we want to drop the commit can't we use an empty commit ( Edit: We need the revert so that the effects of the dropped commit are reversed for any commits we build on top of the |
Yes. The point of dropping a given commit is to drop its changes, too, and that's a |
Isn’t all of this implemented now? |
I might have missed it, is the |
@dscho Oh no sorry, I just tested (git version 2.46.2) and Disregard that. |
All good. Thank you for keeping better tabs on these here tickets than I manage. |
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
would take staged changes (if any), otherwise implicitly --allow-empty,
then create a commit message to be edited in this style:
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
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!.
The text was updated successfully, but these errors were encountered: