如何从命令窗口打开 Git GUI?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18256921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:54:19  来源:igfitidea点击:

How do I open the Git GUI from a command window?

gitwindows-7command-linegit-gui

提问by user2023861

How do I open the Git GUI from a command window? I'm using Windows 7. I've tried running this:

如何从命令窗口打开 Git GUI?我使用的是 Windows 7。我试过运行这个:

"C:\Apps\Git\libexec\git-core\git-gui"

but that's not a windows script. When I right-click on a folder, I see an option that says, "Git GUI Here". When I click on that, the Git GUI opens up. I want to do the same thing from a command line.

但这不是 Windows 脚本。当我右键单击一个文件夹时,我会看到一个选项,上面写着“Git GUI Here”。当我点击它时,Git GUI 会打开。我想从命令行做同样的事情。

回答by Chowlett

Simply entering

只需输入

git gui

works for me.

对我来说有效。

回答by July.Tech

Looks like you installed Git in C:\Apps, so in your case the exact command will be:

看起来您在 C:\Apps 中安装了 Git,所以在您的情况下,确切的命令将是:

"C:\Apps\Git\bin\wish.exe" "C:\Apps\Git\libexec\git-core\git-gui"

Generally, assuming installation in a default location, this is the call:

通常,假设安装在默认位置,调用如下:

"C:\Program Files (x86)\Git\bin\wish.exe" "C:\Program Files (x86)\Git\libexec\git-core\git-gui"

Note that this answer applies to those who selected to not include git in the PATH variable during the installation process (on the screen below). If you selected the second option, then the other answer on this page (to just run "git gui") is the easier way to get to the UI from the command line.

请注意,此答案适用于那些在安装过程中(在下面的屏幕上)选择不将 git 包含在 PATH 变量中的人。如果您选择了第二个选项,则此页面上的另一个答案(仅运行“git gui”)是从命令行访问 UI 的更简单方法。

Git PATH configuration

Git 路径配置

With 64 bit Git installed in the default location on a 64 bit Windows 10 machine, you can use the following line:

在 64 位 Windows 10 机器上的默认位置安装 64 位 Git,您可以使用以下行:

start "" "C:\Program Files\Git\mingw64\bin\wish.exe" "C:\Program Files\Git\mingw64\libexec\git-core\git-gui" "--working-dir" "<path to your Git working directory>"

If you want the Git Gui to run in the current directory, then you don't need the "--working-dir" "<path to your Git working directory>".

如果您希望 Git Gui 在当前目录中运行,那么您不需要"--working-dir" "<path to your Git working directory>".

However, using the above mingw64\bin\wish.exeline results in some issues if Git is configured to use SSH. To have it working properly, it is necessary to change directory to the desired working directory and startgit-gui.exe:

但是,mingw64\bin\wish.exe如果将 Git 配置为使用 SSH ,则使用上述行会导致一些问题。要使其正常工作,必须将目录更改为所需的工作目录,并且startgit-gui.exe

cd <working directory>
start "" "C:\Program Files\Git\cmd\git-gui.exe"

回答by Alex Fainshtein

There isan executable that opens UI, located by default here:

还有就是打开UI可执行文件,默认情况下位于这里:

C:\Program Files\Git\cmd\git-gui.exe

and in your case, apparently, here:

在你的情况下,显然,这里:

C:\Apps\Git\cmd\git-gui.exe

The UI can also be invoked by running generic git.exefrom binor cmdsubfolders with parameter guiand with additional parameters

用户界面也可以通过运行通用调用git.exebincmd与参数的子文件夹gui,并用额外的参数

git gui [<command>] [arguments]

as described in the documentation.

如文档中所述