We have a file in the branch 'feature'; Let's merge it to the master branch.
你有一個文件在分支 'feature',把它合并到 master 分支。
當(dāng)我們在分支完成修改和測試之后,就可以把分支合并到主線上了,它的命令是:
$ git merge branch-name
執(zhí)行這條命令之前,要先切換到主線(一般是 master 分支),然后把待合并的分支名作為參數(shù)。
合并之后,在分支上修改過的文件的內(nèi)容就會體現(xiàn)在主線上,而且日志中也加入了分支的修改日志。
如果遇到主線和分支修改了同一行代碼,就會發(fā)生沖突,后面的關(guān)卡中我們還會學(xué)習(xí)如何解決沖突。
第38關(guān)過關(guān)畫面如下:
http://wiki.jikexueyuan.com/project/githug-walkthrough/images/level-38-merge.png" alt="第38關(guān) merge" />