git “svn update -r”的git等价物是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/573585/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the git equivalent of "svn update -r"?
提问by fratrik
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.
我是最近的 git 转换。能够使用 git-svn 将我的分支保存在本地而不干扰 svn 服务器真是太好了。最新版本的代码中存在一个错误。我想确定一个它工作的时间,以便我可以使用 git bisect。我找不到及时返回的正确命令。谢谢。
回答by Bombe
git checkout HEAD~1
This will move your current HEAD to one revision earlier.
这会将您当前的 HEAD 移动到更早的一个修订版。
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.
这会将您当前的 HEAD 移动到给定的修订版。使用git log
或gitk
查找您要查找的修订。
回答by jmu
And getting back to latest (equivalent to: svn up), you'll need to update the branch, usually:
回到最新(相当于:svn up),你需要更新分支,通常:
git checkout master
This is because the HEAD refers to the version that is being checked out.
这是因为 HEAD 指的是正在检出的版本。
回答by Brr
git pull
seems a more appropriate command for what you are looking for
似乎更适合您要查找的命令
回答by Goody
This seems to do what I wanted, which is what I think you're asking for too
这似乎做我想做的,这也是我认为你要求的
git checkout *
回答by Sandeep Singh
If you are using TortoiseGit then
如果你正在使用 TortoiseGit 那么
Right Click in project folder > TortoiseGit > Pull
回答by VonC
Update 2019: the proper command would be
2019 年更新:正确的命令是
git restore -s @~1
(to, for instance, restore files at their state in HEAD parent commit)
(例如,恢复文件在 HEAD 父提交中的状态)
That is because:
那是因为:
git checkout
is too confusing, dealing both with branches and files.git restore
only... restore files, since Git 2.23 (August 2019).
No need forgit checkout HEAD~ -- .
- Git 1.8.4 introduced
@
as a shortcut notation forHEAD
.
git checkout
太混乱了,处理分支和文件。git restore
仅...恢复文件,自 Git 2.23(2019 年 8 月)以来。
不需要git checkout HEAD~ -- .
- Git 1.8.4
@
作为HEAD
.