git fetch only for current branch

前端 未结 5 1836
刺人心
刺人心 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:29

    Per https://stackoverflow.com/a/12142066/25192 - you can use this to find the name of the current branch:

    git rev-parse --abbrev-ref HEAD

    ...then substitute this into the fetch command as the refspec.

提交回复
热议问题