2016-11-10 8 views
0

端末で 'git pull'を実行すると、マージの競合が発生することがあります。端末で差分ツールを開けません

私が使用してこれらの競合に対するデフォルトの差分ツールを設定しようとしている:私はそれが動作手動ターミナルでopendiff file1.txt file2.txtを入力し、それは、マージの競合を自動的にない作業を行う場合

git config --global merge.tool opendiff 

を。

代わりに、マージ競合の後、VIテキストエディタが開きますが、実際の競合は表示されず、コミットメッセージを入力できる画面のみが表示されます。

デフォルトのマージツールを設定する手順がありません。より完全なmerge.tool定義は良い仕事かどう

+0

http://stackoverflow.com/q/13719122/6309は役立つだろうか? – VonC

答えて

0

チェック:

git config --global merge.tool opendiff 
git config --global mergetool.opendiff.cmd 'opendiff -merge "$MERGED" "$LOCAL" "$REMOTE"' 
git config --global mergetool.opendiff.trustExitCode false 

+0

はい、opendiffは端末に直接入力すると開くので、$ pathにある必要があります。 – Kokodoko

0

私はOSX 10.10でこれをテストした(すでにケースであるべき、あなたの$PATHopendiffがあることを確認してください)。

# locate xcode utilities 
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

# set "opendiff" as the default mergetool globally 
git config --global merge.tool opendiff 

そしてシミュレートします。x次のコマンドを使用して(私のmergetoolは、この前に何か他のものに設定しました) d新しく作成されたgitリポジトリでマージの競合が発生しました。私は別のmergetool git config --global merge.tool bc3で再びこれをテストし

enter image description here

:問題なく差分ツール開かgit mergetoolこれに続いて

enter image description here

あなたのmergetoolが正しく設定されていることを確認することができます次のようにしてください。

git config --list --show-origin 

それは、その後、ここで、問題への手がかりを提供していない場合は、より多くの手がかりを保持しているかもしれませんVERBOSE出力されます:

$ GIT_CURL_VERBOSE=1 GIT_TRACE=2 git mergetool 
+zbell_begin:1> zbell_timestamp=1478783158 
+zbell_begin:2> zbell_lastcmd='GIT_CURL_VERBOSE=1 GIT_TRACE=2 git mergetool' 
+iterm2_preexec:2> PS1=' 
%F{135}%n%f at %F{166}%m%f in %F{118}%~%f ${vcs_info_msg_0_} 
$python_info[virtualenv]$ ' 
+iterm2_preexec:3> ITERM2_SHOULD_DECORATE_PROMPT=1 
+iterm2_preexec:4> iterm2_before_cmd_executes 
+iterm2_before_cmd_executes:1> printf '\033]133;C;\007' 
+-zsh:70> GIT_CURL_VERBOSE=1 GIT_TRACE=2 git mergetool 
13:05:58.178595 git.c:562    trace: exec: 'git-mergetool' 
13:05:58.179015 run-command.c:336  trace: run_command: 'git-mergetool' 
13:05:58.189681 git.c:562    trace: exec: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE' 
13:05:58.190101 run-command.c:336  trace: run_command: 'git-sh-i18n--envsubst' '--variables' 'usage: $dashless $USAGE' 
13:05:58.196721 git.c:562    trace: exec: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE' 
13:05:58.197349 run-command.c:336  trace: run_command: 'git-sh-i18n--envsubst' 'usage: $dashless $USAGE' 
13:05:58.211241 git.c:349    trace: built-in: git 'config' '--bool' 'mergetool.prompt' 
13:05:58.214550 git.c:349    trace: built-in: git 'rev-parse' '--git-dir' 
13:05:58.218507 git.c:349    trace: built-in: git 'rev-parse' '--git-path' 'objects' 
13:05:58.231731 git.c:349    trace: built-in: git 'config' 'merge.tool' 
13:05:58.236048 git.c:349    trace: built-in: git 'config' 'mergetool.opendiff.cmd' 
13:05:58.240211 git.c:349    trace: built-in: git 'config' '--bool' 'mergetool.keepBackup' 
13:05:58.245948 git.c:349    trace: built-in: git 'config' '--bool' 'mergetool.keepTemporaries' 
13:05:58.250250 git.c:349    trace: built-in: git 'rev-parse' '--show-toplevel' 
13:05:58.254733 git.c:349    trace: built-in: git 'ls-files' '-u' 
Merging: 
another-file 

13:05:58.259422 git.c:349    trace: built-in: git 'ls-files' '-u' '--' 'another-file' 
13:05:58.265199 git.c:349    trace: built-in: git 'config' '--bool' 'mergetool.writeToTemp' 
13:05:58.268606 git.c:349    trace: built-in: git 'ls-files' '-u' '--' 'another-file' 
13:05:58.273569 git.c:349    trace: built-in: git 'ls-files' '-u' '--' 'another-file' 
13:05:58.280265 git.c:349    trace: built-in: git 'ls-files' '-u' '--' 'another-file' 
13:05:58.318106 git.c:349    trace: built-in: git 'rev-parse' '--show-cdup' 
13:05:58.350195 git.c:349    trace: built-in: git 'rev-parse' '--show-cdup' 
Normal merge conflict for 'another-file': 
    {local}: created file 
    {remote}: created file 
13:05:58.356881 git.c:349    trace: built-in: git 'config' 'mergetool.opendiff.cmd' 
13:05:58.361075 git.c:349    trace: built-in: git 'config' 'mergetool.opendiff.path' 
13:05:58.365342 git.c:349    trace: built-in: git 'config' 'mergetool.opendiff.cmd' 
13:05:58.370113 git.c:349    trace: built-in: git 'config' 'mergetool.opendiff.cmd' 
+0

git config --list --show-originはエラーを返します:unknow option: "show-origin" – Kokodoko

+0

git mergetoolの冗長出力を有効にするフラグはどうですか...出力は私と比較して何かを伝えますか? –

+0

ありがとうございます。マージの競合をすばやくシミュレートするための最良の方法は何ですか?私はそれが今働いているかどうかわからない:) – Kokodoko

関連する問題