Changing the Git remote 'push to' default

后端 未结 11 1922
失恋的感觉
失恋的感觉 2020-12-04 05:35

I want to change the Git default remote branch destination so I could just

git push

Instead of:

git push upstream
         


        
11条回答
  •  悲哀的现实
    2020-12-04 06:12

    Very simply, and cobbling together some of the great comments here along with my own research into this.

    First, check out the local branch you want to tie to your remote branch:

    git checkout mybranch
    

    Next:

    git branch -u origin/mybranch
    

    where:

    git branch -u {remote name}/{branch name}
    

    You should get a message:

    "Branch mybranch set up to track remote branch mybranch from origin."
    

提交回复
热议问题