Git - What is the difference between push.default “matching” and “simple”

前端 未结 3 1218
猫巷女王i
猫巷女王i 2020-11-28 17:54

I have been using git for a while now, but I have never had to set up a new remote repo myself and I have been curious on doing so. I have been reading tutorials and I am co

3条回答
  •  攒了一身酷
    2020-11-28 18:34

    git push can push all branches or a single one dependent on this configuration:

    Push all branches

    git config --global push.default matching
    

    It will push all the branches to the remote branch and would merge them. If you don't want to push all branches, you can push the current branch if you fully specify its name, but this is much is not different from default.

    Push only the current branch if its named upstream is identical

    git config --global push.default simple
    

    So, it's better, in my opinion, to use this option and push your code branch by branch. It's better to push branches manually and individually.

提交回复
热议问题