目录 搜索
Guides gitattributes giteveryday gitglossary gitignore gitmodules gitrevisions gittutorial gitworkflows Administration git archive git bundle git clean git filter-branch git fsck git gc git instaweb git reflog Basic Snapshotting git add git commit git diff git mv git reset git rm git status Branching and Merging git branch git checkout git log git merge git mergetool git stash git tag Debugging git bisect git blame git grep Email git am git format-patch git request-pull git send-email External Systems git fast-import git svn Getting and Creating Projects git clone git init Git git annotate git archimport git bisect-lk2009 git check-attr git check-mailmap git check-ref-format git checkout-index git cherry git citool git column git credential git credential-cache git credential-store git cvsexportcommit git cvsimport git cvsserver git diff-files git diff-tree git difftool git fast-export git fetch-pack git fmt-merge-msg git get-tar-commit-id git gui git http-backend git http-fetch git http-push git imap-send git index-pack git interpret-trailers git ls-remote git ls-tree git mailinfo git mailsplit git merge-file git merge-index git merge-one-file git merge-tree git mktag git mktree git name-rev git notes git p4 git pack-objects git pack-redundant git pack-refs git parse-remote git patch-id git prune git prune-packed git quiltimport git receive-pack git remote-ext git remote-fd git remote-testgit git repack git replace git rerere git send-pack git sh-i18n git sh-setup git shell git show-branch git show-index git stripspace git unpack-file git unpack-objects git upload-archive git upload-pack git var git verify-commit git verify-tag git whatchanged git worktree Inspection and Comparison git describe git shortlog git show Miscellaneous api credentials api index gitcli gitcore tutorial gitcredentials gitcvs migration gitdiffcore githooks gitk gitnamespaces gitremote helpers gitrepository layout gitsubmodules gittutorial 2 gitweb gitweb.conf pack format User Manual Patching git apply git cherry-pick git rebase git revert Plumbing Commands git cat-file git check-ignore git commit-tree git count-objects git diff-index git for-each-ref git hash-object git ls-files git merge-base git read-tree git rev-list git rev-parse git show-ref git symbolic-ref git update-index git update-ref git verify-pack git write-tree Server Admin git daemon git update-server-info Setup and Config git git config git help Sharing and Updating Projects git fetch git pull git push git remote git submodule
文字

名称

git-merge-index  - 为需要合并的文件运行合并

概要

git merge-index [-o] [-q] <merge-program> (-a | [--] <file>*)

描述

这将查找索引中的<file>(s),并且如果有任何合并条目,则将这些文件的SHA-1散列作为参数1,2,3(空参数,如果没有文件)和<file>作为参数4.三个文件的文件模式作为参数5,6和7传递。

选项

--

不要将更多的参数解释为选项。

-a

针对需要合并的索引中的所有文件运行合并。

-o

不要停止在第一次失败的合并,而是在一次完成所有的合并 - 即使先前的合并返回错误时继续合并,并且仅在所有合并之后返回错误代码。

-q

不要抱怨失败的合并程序(合并程序失败通常表示合并期间发生冲突)。这是为了可能想要发出自定义消息的瓷器。

如果git merge-index使用多个<file> s(或-a)调用,则它将依次处理它们,只有在合并返回非零退出代码时才会停止。

通常,这是通过一个脚本调用 Git 模仿RCS包中的merge命令来运行的。

git merge-one-file分发中包含调用的示例脚本。

警报警报!Git“合并对象顺序”与RCS merge程序合并对象顺序不同。在上述顺序中,原件是第一个。但是,3路合并程序的参数merge是将原件放在中间。不要问我为什么。

示例:

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一旦任何事情返回错误后,如何停止尝试合并(即,cat为 AA 文件返回错误,因为它不存在于原始文件中,因此git merge-index甚至没有尝试合并 MM 事物)。

上一篇: 下一篇: