本文介绍了Git - push.default与“匹配”之间的区别是什么?和“简单”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在一直在使用git,但我从来没有必要自己设置一个新的远程回购,我一直很好奇。我一直在阅读教程,我对如何让git push工作感到困惑。



如果我简单地使用 >可以推送所有分支或一个依赖于此配置的分支:



推送所有分支

  git config --global push.default matching 

它会将所有分支推送到远程分支并合并它们。
如果您不想推送所有分支,则只能推送当前分支。



仅推送当前分支

  git config --global push.default简单

所以,在我看来,使用这个选项更好,并且通过分支推送你的代码。最好是手动和单独推送分支。



如需进一步阅读,请转至此


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 confused on how to get "git push" to work.

If I simply use git push it asks me to see up a default branch(?) to point to? What is the difference between these two options it supplies me with?

git config --global push.default matching
git config --global push.default simple

Matching just pushes whatever branches I have on my local repo, and if they don't match I have to then manually tell it to push whatever new local branches I have, correct? Is this best practice to use or is simple best?

解决方案

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 only.

Push only the current branch

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.

For further reading please go to this blog post

这篇关于Git - push.default与“匹配”之间的区别是什么?和“简单”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 19:51