Default behavior of “git push” without a branch specified

前端 未结 12 1183
眼角桃花
眼角桃花 2020-11-22 05:32

I use the following command to push to my remote branch:

git push origin sandbox

If I say

git push origin

12条回答
  •  粉色の甜心
    2020-11-22 06:22

    I just put this in my .gitconfig aliases section and love how it works:

    pub = "!f() { git push -u ${1:-origin} `git symbolic-ref HEAD`; }; f"
    

    Will push the current branch to origin with git pub or another repo with git pub repo-name. Tasty.

提交回复
热议问题