GIT - 如何合并分支机构? [英] GIT - how to merge branches?
问题描述
我们决定在我们公司使用GIT,但现在出现了问题。
我们有几个不同功能的分支机构。现在我们需要的是将这些分支合并并推送给Master。我们如何使用autoreplace来做到这一点 - 我们有分支-a,分支-b,分支-c-我们需要把它们全部放在Master中,但是在重复文件的情况下分支-B应该是Major和branch-c-minor。
Upd:
分支-a :
-file1
-file2
-file3
-file4
>
分支-b:
- 文件1
- 文件5
- 文件6
分支-c:
-file1
-file2
-file7
-file8
我们需要结果:
$
$ b -file1(from b)
-file2(from a)
-file3(from a)
-file4(from a)
-file5(from b)
-file6(from b)
-file7(from c)
-file8(from c)
执行章鱼合并,不要提交' - 无提交'。来自master
git merge --no-commit分支-a分支-b分支-c
解决所有冲突,然后如果您愿意,可以采用特定版本的文件并提交:
git checkout分支-b - file3
重复其他特定文件。
git add。 -A
git commit
这是您的自定义工作流程的工作方式。 / p>
希望这有助于。
We decided to use GIT in our company but now got a problem.. We have several branches with different features. Now what we need is to merge that branches and push it to Master. How shall we do that with autoreplace - we have branch-a, branch-b, branch-c - we need to get them all in Master but in case of repeated files the branch-b should be Major and branch-c - minor.
Upd:
branch-a: -file1 -file2 -file3 -file4
branch-b: -file1 -file5 -file6
branch-c: -file1 -file2 -file7 -file8
we need in result:
Master: -file1 (from b) -file2 (from a) -file3 (from a) -file4 (from a) -file5 (from b) -file6 (from b) -file7 (from c) -file8 (from c)
Perform an octopus merge and don't commit '--no-commit'. From master
git merge --no-commit branch-a branch-b branch-c
resolve any conflicts, then if as you want, take a specific version of a file and commit:
git checkout branch-b -- file3
repeat for other specific files.
git add . -A
git commit
This is the way your custom work-flow would work.
Hope this helps.
这篇关于GIT - 如何合并分支机构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!