如何将所有内容回滚到之前的提交 [英] How to rollback everything to previous commit

查看:124
本文介绍了如何将所有内容回滚到之前的提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近在一个有多人的项目中,提交如下图所示。标记为红色,你可以看到一个提交的描述/评论'合并?'。



这个提交添加了大量文件并且改变了许多其他文件,并且从未打算发生。



使用我需要做些什么才能将所有内容都回滚到以蓝色突出显示的提交中? (我在屏幕截图中看到了8次提交)。



解决方案

如果您已将推送提交到上游...



通过单击 Reverse File Reverse Hunk 反向选定行。在你想要回滚的提交之后,对所有提交完成此操作。




如果您没有将提交上推...



右键单击提交并单击重置当前分支到这个提交




Recently in a project with multiple people, a commit was made as seen in the image below. Marked in red you can see a commit with the description/comment of 'Merge?'.

This commit added numerous files and altered numerous others and was never intended to take place.

Using what do I need to do to roll everything back to the commit highlighted in blue? (I am 8 commits behind as seen in the screenshot.)

解决方案

If you have pushed the commits upstream...

Select the commit you would like to roll back to and reverse the changes by clicking Reverse File, Reverse Hunk or Reverse Selected Lines. Do this for all the commits after the commit you would like to roll back to also.

If you have not pushed the commits upstream...

Right click on the commit and click on Reset current branch to this commit.

这篇关于如何将所有内容回滚到之前的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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