是否“git push”从其他分支推送所有提交? [英] Does "git push" push all commits from other branches?

查看:773
本文介绍了是否“git push”从其他分支推送所有提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在本地仓库中的许多分支之间传播了很多无法完成的提交,如果输入 git push ,会发生什么情况?是否所有这些提交都会被推送,或者只有那些属于当前分支的提交? 这也取决于您的推送政策( git config push.default

正如我在 git - push current vs. push upstream(tracking ),只有匹配政策推动比当前分支更多。


两端同名

这使得您要推送的存储库记住将推出的​​分支集(例如,如果您始终推送 maint code>和 master 那里并没有其他分支,您推送到的存储库将具有这两个分支,并且您的本地 maint master 将被推送到那里)。

政策,只有简单的 git push 足以推送所有(匹配)分支。

如果没有该策略, git push --all
对于 force 是必须的所有分支被推。


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 push maint and master there and no other branches, the repository you push to will have these two branches, and your local maint and master 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆