Git pull with refspec

后端 未结 3 2010
萌比男神i
萌比男神i 2021-01-26 09:45

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`         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 10:24

    Step 2 is not a true merge, it's a fast-forward merge. Fast-forwarding is the only kind of merge possible for a non-current (i.e., not currently checked out) branch. If fast-forwarding is not possible git would abort fetch/pull; in that case you could either do a true merge (checkout branchC and run git pull origin branchB) or do a forceful update (git fetch origin +branchB:branchC) thus loosing your local commits at the head of branchC.

提交回复
热议问题