Using refspec is a convenient way to grab a remote branch and create a similar one but with given name (or the other way round: create a remote one with a given name different from the local one). I'm puzzled about one tiny thing - as pull will also do the merge with current branch I would expect different behavior from:
git fetch origin master:mymaster
and from
git pull origin master:mymaster
Both of the above commands seem to produce exactly same result - that is a local branch called mymaster, same as origin/master. Am I right or is there a vague difference between the two?
Finally, using a refspec will create a local branch not a tracking branch, right? Since tracking branches are pushed automagically when one invokes git push without any arguments AFAIK
pull
to mergeorigin/master
to localmaster
. – Exploit