英文:
Git branch is at the same state as origin when I checkout to master
问题
After working on a feature branch and also successfully setting my PR, I usually switch back to master. git checkout master
gives me when checking out: Switched to branch "master". Your branch is at the same level as 'origin/master'.
Then when I do a git pull, git pulls down all the new changes on master and merges them into my local master.
Step 1: git checkout master
Step 2: git pull
But why does it tell me at step 1 that it is up to date with the origin? But in step 2, it fetches and merges the new changes. According to my understanding, it would be not up to date then!
英文:
After working on a feature branch and also successfully setting my PR, I usually switch back to master. git checkout master
gives me when checking out: Switched to branch "master". Your branch is at the same level as 'origin/master'.
Then when I do a git pull, git pulls down all the new changes on master and merges them into my local master.
Step 1: git checkout master
Step 2: git pull
But why does well tell me at step 1. that it is up to date with the origin? But in step 2 it fetches and merges the new changes. According to my understanding, it would be yes then not up to date!?
答案1
得分: 2
当你执行 git checkout master
时,Git 不会自动发起网络请求来检查远程服务器的状态。它仅仅检查本地可用的缓存和历史记录树。
然而,如果你在特性分支上执行 git pull --all
,并且远程有变更被推送,那么只有在你执行 git checkout master
时,Git 才会报告你的本地 master
分支落后于 origin/master
。
英文:
When you git checkout master
git will not automatically make a network request to check the remote server state. It merely checks the caches and the history tree available locally to you.
However, if you happen to git pull --all
while in the feature branch and there were changes pushed to the remote, only then git will report that your local master
branch is behind origin/master
when you git checkout master
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论