简体   繁体   English

在 git 恢复我之前的提交后,如何提交我的更改?

[英]How do I commit my changes following a git revert of my previous commit?

I had to revert the "git push" that I had done earlier.我不得不恢复我之前所做的“git push”。 Since that revert on mainline, I have not pulled code and haven't committed anything.自从主线恢复以来,我没有提取代码,也没有提交任何东西。 I still have all the reverted code on my system and additional changes.我的系统上仍然有所有恢复的代码和其他更改。 What is the best way to go about committing the code without losing any of my changes? go 关于提交代码而不丢失我的任何更改的最佳方法是什么?

You could amend that revision (without any changes), so that git sees it as something that has not been merged, then you could rebase.您可以修改该修订版(不做任何更改),以便 git 将其视为尚未合并的内容,然后您可以重新设置基准。

git commit --amend --no-edit

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM