在cmd中从git config中跳出双引号

我想创建一个批处理文件来初始化我的.gitconfig文件中的所有键/值。

我有麻烦试图从cmd中设置以下部分:

[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"

我试过了:

git config --global mergetool.p4merge.cmd "p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED""

但结果是:

[mergetool "p4merge"]
    cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"

我应该如何避免cmd中的双引号?


“Git on Windows:”你如何设置一个mergetool? 建议:

  • 从git bash会话:
  • git config --global mergetool.p4merge.cmd 'p4merge.exe "$BASE" "$LOCAL" "$REMOTE" "$MERGED"'
    
  • 或者,从Windows cmd.exe外壳程序:
  • git config --global mergetool.p4merge.cmd "p4merge.exe "$BASE" "$LOCAL" "$REMOTE" "$MERGED""
    

    所以这取决于你是否启动了git-bash.bat或者git-cmd.bat

    链接地址: http://www.djcxy.com/p/41689.html

    上一篇: escape double quotes in git config from cmd

    下一篇: Git: Use git