Can “git pull --all” update all my local branches?

前端 未结 25 2398
失恋的感觉
失恋的感觉 2020-11-22 16:33

I often have at least 3 remote branches: master, staging and production. I have 3 local branches that track those remote branches.

Updating all my local branches is

25条回答
  •  遥遥无期
    2020-11-22 17:34

    Just posting an updated answer. git-up is no longer maintained and if you read the documentation, they mention the functionality is now available in git.

    As of Git 2.9, git pull --rebase --autostash does basically the same thing.

    Accordingly, if you update to Git 2.9 or later, you can use this alias instead of installing git-up:

    git config --global alias.up 'pull --rebase --autostash'

    You can also set this for every git pull as of Git 2.9 as well (thanks @VonC please see his answer here)

    git config --global pull.rebase true
    git config --global rebase.autoStash true
    

提交回复
热议问题