What is the difference between git push.default=current and push.default=upstream?

前端 未结 2 450
执念已碎
执念已碎 2020-12-04 08:08

The man page for git-config lists these options for push.default:

nothing - do not push anything.
matching - push all matching branches. All branches having          


        
2条回答
  •  囚心锁ツ
    2020-12-04 09:08

    current will push the current branch to a branch with the same name on the remote repo.

    upstream will push the current branch to the upstream branch.

    The upstream branch is a branch which has been explicitly or implicitly defined as being upstream from your current branch. That means that push and pull by default will sync with this branch. The upstream branch may be in the same repo as the current branch itself. You can do interesting things like set up your local master branch as upstream from your local feature (topic) branch, and push and pull between them.

    Implicit upstream setup is done through the branch.autosetupmerge config value. You can find documentation in the git config help page. Explicit upstream setup is done with the -u option to the git branch command. See the help page for details.

提交回复
热议问题