将本地Sourcetree存储库还原为master [英] Revert local Sourcetree repo to master

查看:124
本文介绍了将本地Sourcetree存储库还原为master的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Sourcetree的新手,并且在本地创建了一个混乱的地方,与源/主服务器相比,提前7次提交.我想忽略并删除我在本地完成的所有操作,然后从将本地存储库恢复为当前状态的原始/主数据库来重新开始.我该怎么办?

I'm new to Sourcetree and have created a mess locally, with 7 ahead commits compared to the origin/master. I want to ignore and remove everything I've done locally and start again by reverting my local repo to the origin/master as it currently stands. How do I do this?

备注:我知道源/主服务器是正确的,因为我旁边有另一台机器,我不使用它来进行提交,而只是从源/主服务器上拉了一个,本地存储库在另一台计算机上是正确的.

Remark: I know the origin/master is correct since I have another machine next to me which I don't use to do commits and just did a pull from the origin/master, and the local repo is correct on this other machine.

推荐答案

您可以通过以下方式设置当前的母版以匹配原始母版:

You can set your current master to match the origin master by:

检出master分支.双击分支,或打开终端并键入git checkout master

Check out the master branch. Double click the branch, or open the terminal and type git checkout master

然后将分支重置为原始主机.在日志中找到原始服务器/主服务器,右键单击,单击将当前分支重置为此提交",然后从出现的对话框中进行选择.或使用命令git reset --hard origin/master

Then reset the branch to origin master. Locate origin/master in the log, right click, click "Reset current branch to this commit" and select hard from the dialog that comes up. Or use the command git reset --hard origin/master

这篇关于将本地Sourcetree存储库还原为master的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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