I read this question , and now I have this doubt as to how git pull work with refpec :
Step 1 : I am on branchA.
Step 2 : I do `git pull origin branchB:branchC`
Well, after reading @torek-ans-1 and @torek-ans-2 [This is must read to understand the working of git fetch/pull], I feel to post an complete answer to my question for those who want to get it quickly.
First, the steps in the question are wrong. This is the correct steps :
Step 1 : I am on branchA.
Step 2 : I do `git pull origin branchB:branchC` .
Step 3: I notice :
a) commits from branchB on remote comes and update `refs/heads/branchC`
b) Then based on `remote.origin.fetch` was used to try to update `remotes/origin/branchB` on our local.
[ Notice that no attempts will be made to update `remotes/origin/branchC`]
c) The `branchC` was merged into `branchA`.
[Order might vary from one git version to other]
In step a) + step b) , there is no merge. This is called fast forward update. There is something called fast forward merge too which behaves like this but we say fast forward merge when git merge
behaves like a fast forward update.
Here in step a)+ step b) no git merge
is called . Hence, we call it fast forward update and not fast forward merge.
Step c) is where git merge will be called.
In short : git pull origin branchB:branchC= git fetch origin branchB:branchC ((a) + (b))+ git merge branchC (c)
Now my question was why 2 merge called ?
There are not 2 merge . There is only 1 merge in step c). Yes, there are 2 fast forward update and git fetch
does them.