[英]Amending commit that is edited as part of a rebase in magit
I'm using Emacs + it's in very many ways fabulous magit-mode to work with git. 我正在使用Emacs +它在很多方面很棒的magit模式与git一起工作。 There is one aspect of my workflow though that I can't map to this, and thus this question.
我的工作流程有一个方面,我无法映射到这个,因此这个问题。
Sometimes you have a commit which should be reworked into separate commits. 有时候你有一个提交应该重新设计成单独的提交。 I can interactively rebase my commits with magit, and declare my intend to edit said commit.
我可以使用magit以交互方式重新提交我的提交,并声明我打算编辑所述提交。
Now I have to switch over to git gui, select "ammend last commit" which shows me the staged changes, and unstage those parts I want to become a separate commit. 现在我必须切换到git gui,选择“ammend last commit”,它显示了我的分阶段更改,并取消了我想成为单独提交的那些部分。 Then I commit, stage the exclusions, and commit again - voila, I have a new commit within my history.
然后我提交,分阶段排除,再次提交 - 瞧,我的历史中有一个新的提交。
I have so far not found a way to accomplish this using Emacs. 到目前为止,我还没有找到使用Emacs实现此目的的方法。 Any hints?
任何提示?
After your begin the rebase, instead of going to the gui, do a magit-reset-head to HEAD~1, this will put you in the position to unstage the changes, and stage and commit as desired before finally Continuing the rebase from the magit status buffer. 在你开始使用rebase之后,而不是去gui,做一个magit-reset-head到HEAD~1,这将使你处于取消更改的位置,并根据需要进行阶段和提交,最后继续从magit状态缓冲区。
Example scenario workflow: 示例场景工作流程
magit-log
magit-log
magit-reset-head
( x ), specify HEAD~1
in prompt. magit-reset-head
( x ),在提示符下指定HEAD~1
。 You will now have four commits, each changing one file in the order A, B, C, D. 您现在将有四个提交,每个提交按A,B,C,D顺序更改一个文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.