Git - Automatically fast forward all tracking branches on pull

后端 未结 6 1714
闹比i
闹比i 2020-12-28 12:32

I\'ve set up tracking branches with the --track option, and when I do a git pull on master, it fetches all branches to origin/br

6条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-28 13:36

    If you really want to fast forward all local branches that are tracking remote branches you might want to consider adding this as an alias to your ~/.gitconfig:

    [alias]
        pull-all = !"for b in $(git for-each-ref refs/heads --format='%(refname)') ; do git checkout ${b#refs/heads/} ; git pull --ff-only ; done"
    

    You can then run git pull-all, it will iterate through your local branches and run a git pull --ff-only on each.

提交回复
热议问题