在 Mac 上通过 Homebrew 使用 git-gui

jon*_*ard 20 git homebrew macos

我用 Homebrew 安装了 Git。

但是,git-gui似乎没有现货/usr/local/bin

这个答案建议我应该创建一个别名到usr/local/git/libexec/git-core/git-gui,但这个文件不存在。

我能找到的唯一可执行文件位于

/usr/local/Cellar/git/1.8.4/share/git-gui
Run Code Online (Sandbox Code Playgroud)

现在这是我使用的别名。但是,如果我更新 Git,我将不得不重新链接它。

我如何获得永久参考git-gui

Lri*_*Lri 14

/usr/local/opt/包含指向以下目录的符号链接/usr/local/Cellar/

$ ll /usr/local/opt/git
lrwxr-xr-x  1 lauri  admin    19B Oct 11 17:07 /usr/local/opt/git -> ../Cellar/git/1.8.4
$ ll /usr/local/opt/git/libexec/git-core/git-gui
-rwxr-xr-x  2 lauri  admin   205B Sep 18 23:28 /usr/local/opt/git/libexec/git-core/git-gui
Run Code Online (Sandbox Code Playgroud)

检查文件是否存在,然后在 ~/.gitconfig 中添加如下内容:

[alias] 
gui = !sh -c '/usr/local/opt/git/libexec/git-core/git-gui'
Run Code Online (Sandbox Code Playgroud)


Den*_*enç 13

自 Homebrew 上的git公式2.25.0_1 版本以来,git gui功能已分离到git-gui公式中。有关此更改的背景,请参阅以下拉取请求:https : //github.com/Homebrew/homebrew-core/pull/49136

因此,修复git gui Homebrew 安装git损坏的更好解决方案是运行:

brew install git-gui
Run Code Online (Sandbox Code Playgroud)