【问题标题】:Git alias to open the git installation folder打开git安装文件夹的git别名
【发布时间】:2022-01-06 21:47:07
【问题描述】:

我想创建一个git别名git dir,使用时应该通过Windows资源管理器打开git安装文件夹,如何实现这样的别名?

【问题讨论】:

    标签: windows bash git git-bash explorer


    【解决方案1】:

    如果使用 Git Bash,请尝试:

    git config --global alias.dir '!explorer $(cygpath -w $(git --exec-path))'
    

    【讨论】:

      【解决方案2】:

      以 ! 开头的别名将其视为命令。

      我手头没有windows机器,但是对于Linux:

      git config --global alias.open '!git --exec-path | xargs xdg-open'
      

      按描述工作。

      所以您要查找的命令可能类似于:

      git config --global alias.open "!git --exec-path | 'sed s~/~\\~g' | xargs explorer"
      

      【讨论】:

      • @WenfangDu:这可能意味着 \ 字符被某种方式吞噬了 - 尝试使用 \\\\ 而不是 \\.
      猜你喜欢
      • 2014-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-09
      • 1970-01-01
      • 1970-01-01
      • 2016-04-15
      相关资源
      最近更新 更多