【发布时间】:2017-04-03 00:04:14
【问题描述】:
我对存储库中的分支和主分支有疑问。
如果我有 2 个不同的协作者同时在我的存储库上工作,其中一个在 master 分支上工作,而另一个在一个分支本身上工作,如果两个协作者都将代码推送到同时?
主分支推送的代码会覆盖另一个分支吗?
谢谢!
【问题讨论】:
标签: github repository bitbucket
我对存储库中的分支和主分支有疑问。
如果我有 2 个不同的协作者同时在我的存储库上工作,其中一个在 master 分支上工作,而另一个在一个分支本身上工作,如果两个协作者都将代码推送到同时?
主分支推送的代码会覆盖另一个分支吗?
谢谢!
【问题讨论】:
标签: github repository bitbucket
处理冲突:
Suppose A and B are two collaborators;
A working on master branch;
B working on other branch;
在这种情况下,可能会发生冲突:
Despite of being at the different branch,
A and B both are working on the same file like file.php
考虑覆盖
If you want to override one branch with another, You can use following command like:
git merge 'branch_name'
这会将“branch_name”分支与您当前的工作分支合并。
【讨论】:
不会有冲突,您的帖子正是使用分支的原因!
唯一会发生冲突的情况是 2 个人尝试同时在同一个分支中提交同一个文件。
【讨论】: