开发者

How can I change history by directly editing patches and metadata?

开发者 https://www.devze.com 2023-01-18 10:34 出处:网络
Git has a bunch of procedures for altering history. (rebase, filter-branch, commit --ammend, guilt, stacked git, etc)

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 edited. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号