How can I find out the command line options for git-bash.exe?

Apparently my google-fu sucks...

I know these from other StackExchange posts:

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

Where can I find a complete list of options for git-bash.exe (the therminal emulator)? I found them for mintty [1], but they don't seem to be the correct ones for git-bash.exe...


Update:

So git-bash.exe just seems to be a simple wrapper that first parses the --cd... options and then runs

usr\bin\mintty.exe --icon git-bash.exe,0 --exec "/usr/bin/bash" --login -i <other arguments>

or similar. That's why only --cd.. and bash options are parsed correctly and not mintty.

If you want to use other options from mintty, you should use a similar command instead of trying to do it with git-bash.exe. E.g.:

usr\bin\mintty.exe --icon git-bash.exe,0 --window full --exec "/usr/bin/bash" --login -i -c "echo 'Hello World!'; read"

Solution 1:

Correct there isn't a list of command line options help for git-bash.exe. I spend some time looking for them myself and there isn't any proper documentation on it. It appears to be a wrapper for bin/sh.exe. If you really need to do more then I recommend looking at the help info for sh.exe instead.

Solution 2:

I found this commit from 2015 that introduced new command line options: https://github.com/git/git/commit/ac6b03cb4197311b055dc5f46ab10bf37c591ae6

Here is the list from the commit description:

--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

You can read the full information in the URL above.

Solution 3:

Here is the command line you found when you start git-bash.exe (on 2.8.1)

usr\bin\mintty.exe -o AppID=GitForWindows.Bash -o RelaunchCommand="C:\Git\git-bash.exe" -o RelaunchDisplayName="Git Bash" -i /mingw32/share/git/git-for-windows.ico /usr/bin/bash --login -i