?
This document uses PHP Chinese website manual Release
git-merge-index - 為需要合并的文件運(yùn)行合并
git merge-index [-o] [-q] <merge-program> (-a | [--] <file>*)
這將查找索引中的<file>(s),并且如果有任何合并條目,則將這些文件的SHA-1散列作為參數(shù)1,2,3(空參數(shù),如果沒(méi)有文件)和<file>作為參數(shù)4.三個(gè)文件的文件模式作為參數(shù)5,6和7傳遞。
--
不要將更多的參數(shù)解釋為選項(xiàng)。
-a
針對(duì)需要合并的索引中的所有文件運(yùn)行合并。
-o
不要停止在第一次失敗的合并,而是在一次完成所有的合并 - 即使先前的合并返回錯(cuò)誤時(shí)繼續(xù)合并,并且僅在所有合并之后返回錯(cuò)誤代碼。
-q
不要抱怨失敗的合并程序(合并程序失敗通常表示合并期間發(fā)生沖突)。這是為了可能想要發(fā)出自定義消息的瓷器。
如果git merge-index
使用多個(gè)<file> s(或-a)調(diào)用,則它將依次處理它們,只有在合并返回非零退出代碼時(shí)才會(huì)停止。
通常,這是通過(guò)一個(gè)腳本調(diào)用 Git 模仿RCS包中的merge
命令來(lái)運(yùn)行的。
git merge-one-file
分發(fā)中包含調(diào)用的示例腳本。
警報(bào)警報(bào)!Git“合并對(duì)象順序”與RCS merge
程序合并對(duì)象順序不同。在上述順序中,原件是第一個(gè)。但是,3路合并程序的參數(shù)merge
是將原件放在中間。不要問(wèn)我為什么。
示例:
torvalds@ppc970:~/merge-test> git merge-index cat MM This is MM from the original tree. # original This is modified MM in the branch A. # merge1 This is modified MM in the branch B. # merge2 This is modified MM in the branch B. # current contents
亦或是
torvalds@ppc970:~/merge-test> git merge-index cat AA MM cat: : No such file or directory This is added AA in the branch A.This is added AA in the branch B.This is added AA in the branch B.fatal: merge program failed
后面的例子顯示了git merge-index
一旦任何事情返回錯(cuò)誤后,如何停止嘗試合并(即,cat
為 AA
文件返回錯(cuò)誤,因?yàn)樗淮嬖谟谠嘉募?,因?code>git merge-index甚至沒(méi)有嘗試合并 MM 事物)。