[英]Git undo a particular commit from the long past
Say these are my commits: 说这些是我的承诺:
A->B->C->D->E A-> B-> C-> D-> E
Now I'm at commit E. But I want to undo the changes I've done between B->C. 现在我正在提交E。但是我想撤消在B-> C之间所做的更改。 But I want to keep the changes I made from C->D->E.
但是我想保留我从C-> D-> E所做的更改。 Perhaps it's a feature I thought it works but it hasn't been thoroughly tested and I want to remove it.
也许它是我认为可以使用的功能,但尚未经过全面测试,因此我想删除它。 So I want a version F which is the same as E but without the changes I made between B->C.
因此,我需要一个与E相同的F版本,但没有我在B-> C之间所做的更改。
How do I do that? 我怎么做? I tried
git diff
to get the difference in B->C but then do git apply
. 我尝试了
git diff
来获取B-> C的差异,但是然后执行git apply
。 It does not apply. 它不适用。
git revert <commit>
创建一个新的提交,其中删除指定提交的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.