git push vs git push origin

后端 未结 2 2044
忘了有多久
忘了有多久 2020-12-12 22:10

I\'m quite new to Git.

I\'m creating a branch and then want to push it to origin.

I think that simply issuing git push (while stand

2条回答
  •  没有蜡笔的小新
    2020-12-12 22:23

    The first push should be a:

    git push -u origin branchname
    

    That would make sure:

    • your local branch has a remote tracking branch of the same name referring an upstream branch in your remote repo 'origin',
    • this is compliant with the default push policy 'simple'

    Any future git push will, with that default policy, only push the current branch, and only if that branch has an upstream branch with the same name.
    that avoid pushing all matching branches (previous default policy), where tons of test branches were pushed even though they aren't ready to be visible on the upstream repo.

提交回复
热议问题