简体   繁体   English

“ git fetch”在回购上没有任何作用

[英]The “git fetch” does nothing on repo

I noticed with git log origin/master that new a commit is up. 我用git log origin / master注意到新的提交已启动。 So I want to "see" this commit on my local repo. 所以我想在本地仓库上“看到”这个提交。

I do this 我做这个

$ git fetch -v
From xxx.xxx:proj/test
= [up to date]      master     -> origin/master

Everything seems fine... But nothing has changed on my local repo !? 一切似乎都很好...但是我的本地仓库没有任何变化!?

To update your branches (as opposed to your Git's memory of some other Git's branches— git fetch updates this memory only), you must run a second Git command. 要更新您的分支(与Git的其他一些Git分支的内存相反git fetch仅更新此内存),您必须运行第二个 Git命令。

The second command to run is sometimes git merge and sometimes git rebase , depending on how you prefer to work. 运行的第二个命令有时是git merge ,有时是git rebase ,这取决于您的工作方式。 If you have no preference yet, use either one until you do have a preference. 如果您还没有偏好,请使用其中任何一个,直到您有了偏好为止。

There is a convenience command spelled git pull , that runs both git fetch and then the second command. 有一个方便的命令拼写为git pull ,它同时运行git fetch和第二个命令。 The second command it runs is the one you tell it to. 它运行的第二个命令就是您告诉它的命令。 You must configure it based on your choice of second command to use. 您必须根据要使用的第二条命令来配置它。 I recommend avoiding this until you really understand what the second command is and does, because eventually something will go wrong when running the second command. 我建议您在真正了解第二条命令的含义之前避免使用此命令,因为运行第二条命令最终会出问题。 If you do not know that git pull is running this second command, you will not only not know what to do about this failure ... you won't even know that you need to look for how to fix problems with the other command! 如果您不知道 git pull正在运行第二个命令,那么您不仅将不知道该失败的处理方法,甚至不知道您需要寻找解决其他命令的方法!

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

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