Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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 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!?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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 .

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading