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

后端 未结 21 2278
南方客
南方客 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条回答
  •  萌比男神i
    2020-11-22 09:18

    You can set up a really good alias that can handle this without the overly verbose syntax.

    I have the following alias in ~/.gitconfig:

    po = "!git push -u origin \"$(git rev-parse --abbrev-ref HEAD)\""
    

    After making a commit on a new branch, you can push your new branch by simply typing the command:

    git po
    

提交回复
热议问题