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

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

问题描述

最近在一个多人项目中,进行了如下图所示的提交.标记为红色,您可以看到带有合并?"的描述/评论的提交.

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.

使用我需要做什么才能将所有内容回滚到以蓝色突出显示的提交?(如截图所示,我落后 8 次提交.)

Using atlassian-sourcetree 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.)

推荐答案

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

通过点击Reverse FileReverse HunkReverse Selected Lines,选择您想要回滚的提交并撤销更改.对您想要回滚的提交之后的所有提交执行此操作.

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.

右击提交并点击Reset current branch to this commit.

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

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