Why do I need to do `--set-upstream` all the time?

后端 未结 21 2382
南方客
南方客 2020-11-22 09:15

I create a new branch in Git:

git branch my_branch

Push it:

git push origin my_branch

Now say someone mad

21条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-22 09:23

    You can use:

    git config --global branch.autosetupmerge always
    

    which will link the upstream branch each time you create or checkout a new branch.

    See https://felipec.wordpress.com/2013/09/01/advanced-git-concepts-the-upstream-tracking-branch/

    This also works with branch.autosetuprebase, if you follow a more rebase focused workflow, but don't use this unless you know what you're doing, as it will default your pull behavior to rebase, which can cause odd results.

提交回复
热议问题