是否“git push”从其他分支推送所有提交? [英] Does "git push" push all commits from other branches?
问题描述
如果我在本地仓库中的许多分支之间传播了很多无法完成的提交,如果输入 git push
,会发生什么情况?是否所有这些提交都会被推送,或者只有那些属于当前分支的提交? 这也取决于您的推送政策( git config push.default
)。
正如我在 git - push current vs. push upstream(tracking ),只有匹配政策推动比当前分支更多。
两端同名。
这使得您要推送的存储库记住将推出的分支集(例如,如果您始终推送maint code>和
master
那里并没有其他分支,您推送到的存储库将具有这两个分支,并且您的本地maint
和master
将被推送到那里)。
政策,只有简单的 git push
足以推送所有(匹配)分支。
如果没有该策略,
If I have many unpushed commits spread among many branches in my local repo, what happens if I type git push
? Will all of those commits be pushed or only those which belong to the current branch?
It also depends on your push policies (git config push.default
).
As I explain in "git - push current vs. push upstream (tracking)", only the "matching" policy pushes more than the current branch.
push all branches having the same name on both ends.
This makes the repository you are pushing to remember the set of branches that will be pushed out (e.g. if you always pushmaint
andmaster
there and no other branches, the repository you push to will have these two branches, and your localmaint
andmaster
will be pushed there).
With that policy, only a simple git push
is enough to push all (matching) branches.
Without that policy, a git push --all
is necessary to force all branches to be pushed.
这篇关于是否“git push”从其他分支推送所有提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!