What's the git equivalent of “svn update -r”?

不羁岁月 提交于 2019-12-04 08:01:58

问题


I'm a recent git convert. It's great to be able to use git-svn to keep my branches locally without disturbing the svn server. There was a bug that existed in the latest version of the code. I wanted to establish a time when it worked so that I could use git bisect. I couldn't find the right command to move back in time. Thanks.


回答1:


git checkout HEAD~1

This will move your current HEAD to one revision earlier.

git checkout <sha>

This will move your current HEAD to the given revision. Use git log or gitk to find the revision you’re looking for.




回答2:


And getting back to latest (equivalent to: svn up), you'll need to update the branch, usually:

git checkout master

This is because the HEAD refers to the version that is being checked out.




回答3:


git pull 

seems a more appropriate command for what you are looking for




回答4:


This seems to do what I wanted, which is what I think you're asking for too

git checkout *



回答5:


If you are using TortoiseGit then

Right Click in project folder > TortoiseGit > Pull


来源:https://stackoverflow.com/questions/573585/whats-the-git-equivalent-of-svn-update-r

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