当为Git使用外部diff工具时,如何将完整路径传递给工具而不是相对路径?

时间:2012-06-16 11:30:12

标签: macos git p4merge

我正在尝试使用shell脚本和.gitconfig在使用git扩展文件时打开p4merge(在Mac上)。

它几乎正常工作,但我对“右”文件(第二个文件)的相对路径有问题,该文件传递给p4merge:

~> git diff <absolute path>/django/templates/pagination.html 
output: 
/<absolute path to prev version>//jtpgjm_pagination.html django/templates/pagination.html
Incorrect parameters: 'django/templates/pagination.html' is (or points to) an invalid file.

正在第一个参数上展开完整路径,但在第二个参数上不展开。我可以做些什么来触发第二个文件的完整文件路径吗?

1 个答案:

答案 0 :(得分:0)

使用此:

readlink -f django/templates/pagination.html

作为命令的参数,例如:

echo $(readlink -f django/templates/pagination.html)

相关问题