How do I make git automatically run git mergetool
for any merge conflict? This should apply for all merges, using merge
, rebase
, pull
, etc.
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Emacs shell: save commit message
- Can I organize Git submodules in a flat hierarchy?
- Upload file > 25 MB on Github
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
You cannot (yet) make git do this.
This may or may not be an acceptable workaround.
Create a function in your
~/.bashrc
:Mergetool isn't invoked when it merges:
Mergetool is called when there are conflicts:
Mergetool is not called on other errors:
As far as I know, there is no porcelain way to do it.
You can have a wrapper around git like this (file
git_mergetool.sh
, on your path,+x
):Then add alias:
Every time you invoke git, the wrapper will check if the word "CONFLICT" pops up. If it does - wrapper launches mergetool.
This can be improved by adding more precise phrase to
$SEARCH
(like "Automatic merge failed; fix conflicts and then commit the result.") as well as by checking if first argument ($1
) is in the list of commands resulting in merge conflict (pull
,merge
, etc...). Otherwise you will end up parsing a lot of unnecessary data if git command output is too long.You could always use alias
And/or write a helper script along these lines
and then
There is no direct way of invoking mergetool, because it is only one of several ways to merge (see "HOW TO RESOLVE CONFLICTS" in man 1 git-merge).