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

后端 未结 21 2275
南方客
南方客 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:21

    I use this Git alias instead of copy/pasting the suggestion from Git every time: https://gist.github.com/ekilah/88a880c84a50b73bd306

    Source copied below (add this to your ~/.gitconfig file):

    [alias]
      pushup = "!gitbranchname() { git symbolic-ref --short HEAD; }; gitpushupstream() { git push --set-upstream origin `gitbranchname`; }; gitpushupstream"
    

提交回复
热议问题