How can I change history by directly editing patches and metadata?
Git has a bunch of procedures for altering history.
(rebase
, filter-branch
, commit --ammend
, guilt
, stacked git
, etc)
However, it may sometimes be preferable if there was a procedure to turn the last few commits into a file conta开发者_如何学Goining a series of patches with the commit metadata, which could be freely edited, and then turned back into a rebased history (assuming the patches still applied).
Does anyone have a way to do this?
During your git rebase -i
, set the commits you want to change to be edit
ed. Then you can modify them and re-commit with another message all you want.
You could try git format-patch
and git am
, but that would generate one file per commit though.
You can also use git diff
, but that would combine several commits into one patch.
I ended up using magit which solves roughly this problem very well for me.
精彩评论