代码之家  ›  专栏  ›  技术社区  ›  c-urchin

git difftool问题:未设置本地、远程变量

  •  0
  • c-urchin  · 技术社区  · 16 年前

    git config --global diff.tool mytest  
    git config --global difftool.mytest.cmd mytest.sh  
    git config --global difftool.prompt false  
    

    使用mytest.sh:

    #!/bin/sh  
    echo "LOCAL:$LOCAL REMOTE:$REMOTE"  
    

    援引:

    git difftool --tool mytest <commitid> -- <path-to-file>  
    

    LOCAL: REMOTE:  
    

    有什么建议吗?

    2 回复  |  直到 16 年前
        1
  •  4
  •   jamessan    16 年前

    手册页的意思是difftool;工具>。cmd可以有 $LOCAL 和 $REMOTE

    为了用一个例子来演示,这里有一个原始设置的重新工作版本。

    git config --global diff.tool mytest  
    git config --global difftool.mytest.cmd 'mytest.sh $LOCAL $REMOTE'
    git config --global difftool.prompt false
    
        2
  •  0
  •   Aaron    16 年前

    这是我一直使用的差异包装器(与tkdiff一起使用):

    #!/bin/sh
    
    # diff is called with 7 parameters:
    # path old-file old-hex old-mode new-file new-hex new-mode
    
    tkdiff "$2" "$5"
    

    $LOCAL 和 $REMOTE .