如何找出 git-bash.exe 的命令行选项?

816*_*055 69 windows command-line git-bash

显然我的 google-fu 很烂...

我从其他 StackExchange 帖子中了解到这些:

--cd-to-home    # Change directory to home
--cd=<path>     # Change directory to <path>
-i              # ?
-c              # Run command, but --command doesn't work/exist
Run Code Online (Sandbox Code Playgroud)

在哪里可以找到 git-bash.exe(热模拟器)的完整选项列表?我为 mintty [ 1 ]找到了它们,但它们似乎不是 git-bash.exe 的正确选择...


更新:

所以git-bash.exe似乎只是一个简单的包装器,首先解析--cd...选项然后运行

usr\bin\mintty.exe --icon git-bash.exe,0 --exec "/usr/bin/bash" --login -i <other arguments>
Run Code Online (Sandbox Code Playgroud)

或类似。这就是为什么 only--cd..和 bash 选项被正确解析而不是 mintty 的原因。

如果你想使用 mintty 的其他选项,你应该使用类似的命令,而不是尝试使用git-bash.exe。例如:

usr\bin\mintty.exe --icon git-bash.exe,0 --window full --exec "/usr/bin/bash" --login -i -c "echo 'Hello World!'; read"
Run Code Online (Sandbox Code Playgroud)

Mei*_*hen 23

我发现这个 2015 年的提交引入了新的命令行选项:https : //github.com/git/git/commit/ac6b03cb4197311b055dc5f46ab10bf37c591ae6

这是提交描述中的列表:

--command=<command-line>::
    Executes `<command-line>` instead of the embedded string resource

--[no-]minimal-search-path::
    Ensures that only `/cmd/` is added to the `PATH` instead of
    `/mingw??/bin` and `/usr/bin/`, or not

--[no-]needs-console::
    Ensures that there is a Win32 console associated with the spawned
    process, or not

--[no-]hide::
    Hides the console window, or not
Run Code Online (Sandbox Code Playgroud)

您可以在上面的 URL 中阅读完整信息。


小智 18

正确的是没有 git-bash.exe 的命令行选项帮助列表。我花了一些时间自己寻找它们,但没有任何适当的文档。它似乎是 bin/sh.exe 的包装器。如果您确实需要做更多,那么我建议您查看 sh.exe 的帮助信息。

  • 是的,这对于`-c`、`-i`、`--login` 等选项来说似乎是准确的。这是[在线手册页](http://linux.die.net/man/1/sh )。我主要想知道 `-i` 选项的作用。`--cd-to-home` 和 `--cd` 不是 `sh` 命令(也不是 `mintty`),所以我想它们是为了方便而添加的,并且想知道是否还有更多... PS:有还有 *C:\Program Files\Git\usr\bin\mintty.exe* (3认同)

小智 15

我还想知道如何获取命令行选项,谷歌搜索提出了这个线程。

我发现这些选项记录在 git 中。

称呼:

git help git-bash
Run Code Online (Sandbox Code Playgroud)

它将在浏览器中打开一个 git-bash 手册页,解释所有选项