git分支的合并
一、如何分支的合并 在git中,可以使用git merge 和git rebase两个命令来进行分支的合并。 git merge 和git rebase在大体上都差不多,下文主要以git merge来例来讲解分支的合并流程。 如果你想了解分支合并的更多内容,请阅读《 git merge简介 》,《 git rebase简介(基本篇) 》和《 git rebase简介(高级篇) 》。 git merge命令示例: $ git merge branchname 这个命令把分支"branchname"合并到了当前分支里面。 如有冲突(冲突--同一个文件在远程分支和本地分支里按不同的方式被修改了);那么命令的执行输出就像下面一样 $ git merge next 100% (4/4) done Auto-merged file.txt CONFLICT (content): Merge conflict in file.txt Automatic merge failed; fix conflicts and then commit the result. 在有问题的文件上会有冲突标记,在你手动解决完冲突后就可以把此文件添 加到索引(index)中去,用git commit命令来提交,就像平时修改了一个文件 一样。 如果你用gitk来查看commit的结果,你会看到它有两个父分支