Revert local Sourcetree repo to master

旧巷老猫 提交于 2020-11-29 02:52:34

问题


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.


回答1:


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

Check out the master branch. Double click the branch, or open the terminal and type git checkout 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



来源:https://stackoverflow.com/questions/46010005/revert-local-sourcetree-repo-to-master

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!