I have a situation where I didn't understand the updation how it happens internally.
I have 2 remote branches:
master
dev
Now, I want to create 3 local branches out of dev.
Command 1:
git checkout dev
command 2:
git checkout -b "Us1DevBranch" origin/dev
command 3:
git checkout -b "Us2DevBranch" origin/dev
When a git branch
command is executed I have,
dev
Us1DevBranch
Us2DevBranch
Scenario:- After 5 days I picked a branch Us1DevBranch and starting adding some files into this branch. In these 5 days, lets suppose 5 modifications were made to the remote dev branch and I wanted to take an update.
Now when I did, git pull origin dev
it affected only my local dev
branch. The other 2 branches Us1DevBranch & Us2DevBranch
didn't get updated.
Questions:-
1) What I read in the documentation and other discussion forum is that, git pull internally does a git fetch and then a git merge to the local branches created out of that branch. But then why the other 2 branches didn't get updated!
2) I was under the impression that checking out a branch with -b
option is just to give a different local name to the branch & everything else is same. But there is something much more than that, as when I did git pull
, only the branch created out of the option git checkout dev
got affected, not the other branches! Why is it so?