我如何“取消还原”恢复Git提交? [英] How do I "un-revert" a reverted Git commit?

查看:127
本文介绍了我如何“取消还原”恢复Git提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定使用 commit 提交的更改,然后使用 revert 进行恢复,那么最好的方法是什么然后撤销这个回复?



理想情况下,这应该用新的提交来完成,以免重写历史记录。


<如果你还没有推动这个变化, git reset --hard HEAD ^



否则,恢复恢复是完全正常的。



另一种方法是 git checkout HEAD ^^ - 。,然后 git add -A&& git commit


Given a change that has been committed using commit, and then reverted using revert, what is the best way to then undo that revert?

Ideally, this should be done with a new commit, so as to not re-write history.

解决方案

If you haven't pushed that change yet, git reset --hard HEAD^

Otherwise, reverting the revert is perfectly fine.

Another way is to git checkout HEAD^^ -- . and then git add -A && git commit.

这篇关于我如何“取消还原”恢复Git提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆