git fetch only for current branch

前端 未结 5 1741
刺人心
刺人心 2021-02-14 06:33

I know that I can fetch any remote branch to any local branch, but is there also some kind of shortcut to fetch just from the tracked remote branch to the current tracking local

5条回答
  •  我寻月下人不归
    2021-02-14 07:15

    Let's assume that you have origin remote with master, develop branches. You want to sync master but not develop.

    You can do the following steps:

    git fetch origin
    git merge origin/master
    

    UPDATE: in case of only branch have to be fetched:

    git fetch origin master
    git merge FETCH_HEAD
    

提交回复
热议问题