简体   繁体   English

git,尝试从远程提取特定提交,而不是最近提交

[英]git, trying to pull a specific commit from remote, not the most recent one

How can I pull a specific commit, or rather pull the repo the way it was after a specific commit? 我怎样才能提取特定的提交,或者更确切地说是在特定提交后的方式提取回购? I don't have any branches. 我没有任何分支机构。 I'm just running master, and I am the only one using this repo. 我只是在掌握大师,我是唯一一个使用这个回购的人。

You can pull an then checkout the commit you want to see: 您可以拉出然后结帐您想要查看的提交:

git pull && git co <commit>

or you can pull and then reset HEAD to a different commit: 或者你可以拉动然后将HEAD重置为另一个提交:

git pull && git reset --hard <commit>

I do not think there is a way to pull only a specific commit since it is easy it git to switch to another commit if needed. 我认为没有办法只提取一个特定的提交,因为如果需要,它很容易切换到另一个提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM