2014-05-06 193 views
0

我有一个有关git分支的概念性问题。我有一个项目即将进行重大重构。git分支和远程主存储库

源代码保存在一个git存储库中,其主服务器托管有第三方云服务器。我有一个通常工作的本地下游克隆(提交,然后推送原始主机)。其他开发人员以相同的方式处理项目,并根据需要向上游提交它们的提交。

[remote repository (master?)] <-- [my repository (local?)] 

我想创建分支,我可以提交重构的代码。所有的开发者都应该能够以同样的方式在新的分支上工作。也就是说,它必须存在于主人身上。

据我所知,以下命令会在我的本地存储库上创建一个分支。

git branch this_is_my_branch_name 
git checkout this_is_my_branch_name 

但是这个分支也传播到远程主?

非常感谢您提供有关此问题的任何说明。

回答

0

好吧,我找到了答案。这里记录它为后人:

git push origin this_is_my_new_branch_name 

或者,你可以先创建原点库分支,然后让你的本地仓库跟踪。

git push origin origin:refs/heads/this_is_my_new_branch_name 
git checkout --track -b new_feature_name origin/this_is_my_new_branch_name 

关于这一主题的更多信息可以在这里找到:

http://gitready.com/beginner/2009/02/02/push-and-delete-branches.html http://www.zorched.net/2008/04/14/start-a-new-branch-on-your-remote-git-repository/