2012-12-05 81 views
15

您好我想使用了opendiff作爲git的合併工具,但是當我運行合併工具我收到此錯誤信息:如何使用了opendiff作爲默認的合併工具

合併工具了opendiff不作爲「了opendiff」

我在做什麼錯?這是工作的罰款過,但因爲我安裝了一個新的硬盤它不工作了:(

+0

什麼操作系統您使用的? – Ikke

+0

這是在OSX Snow Leopard上。 – CorpusCallosum

+0

清潔opendiff並重新安裝?我希望你已經試過了 – Ram

回答

12

確保你已經安裝了XCode。(如果你使用Git,那麼你可能使用BREW,在這種情況下,你可能已經擁有了XCode 。安裝)

一次性的解決方法是告訴你要使用git什麼工具:

$ git mergetool -t opendiff 

至於設立了opendiff爲默認工具,你需要設置「merge.tool 「變量在你的git配置文件中。

+0

jeetworks鏈接已經死了 –

+0

thx,Brian。答案已經更新。 – cogell

16

你需要到了opendiff配置爲全局merge.tool:

# 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 

如果你Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo,打開Xcode和接受許可修復該問題

+0

何時需要'xcode-select'命令? –

+0

我想'git'還沒有找到,但很難理解你在這種情況下會如何結束。 – Tommy

1

混帳支持--dir-DIFF(-d)執行目錄diff,在FileMerge中看起來不錯。但是,使用opendiff和--dir-diff有一些小問題。 opendiff沒有--merge目標預設,git會盡快刪除臨時文件以保存更改。我的解決方法是使用一個小小的bash腳本來調用FileMerge。我叫它gdiff

#!/bin/bash 
# find top level of git project 
dir=$PWD 
until [ -e "$dir/.git" ]; do 
    if [ "$dir" == "/" ]; then 
    echo "Not a git repository" >&2 
    exit 1; 
    fi 
    dir=`dirname "$dir"` 
done 
# open fresh FileMerge and wait for termination 
open -a FileMerge -n -W --args -left "$1" -right "$2" -merge "$dir" 

https://gist.github.com/miner/e73fc98a83a8fe05d9ef000d46d68a9f

這樣稱呼它:

git difftool -d -x gdiff

相關問題