94

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"
5
  • Did you tried to start with help? If it works like git under linux from command-line you can ask git --help -a to have the full list of commands.
    – Hastur
    Jul 24, 2016 at 13:39
  • Stack Overflow duplicate: gitbash command quick reference
    – DavidPostill
    Jul 24, 2016 at 13:53
  • 1
    git-bash.exe is the terminal emulator (based on mintty) which has collection of standard commands like ls or git (based on msys). I know how to get the options for those commands, I'm looking for the options for the terminal emulator. I have also tried git-bash.exe --help and git-bash.exe /?, both don't show anything.
    – 816-8055
    Jul 24, 2016 at 14:15
  • 7
    @DavidPostill not a dupe -- this asks for command-line options to the shell invocation command
    – gt6989b
    Oct 27, 2016 at 16:28
  • 4
    It may be worth moving your edit to an answer and mark that as the answer.
    – dumbledad
    Jul 19, 2017 at 10:12

5 Answers 5

16

I also wondered on how to get command line options and Google search brought up this thread.

I found that the options are documented within git.

Call:

git help git-bash

and it will open up a git-bash manual page in your browser explaining all the options

1
  • Wow thanks, this is what I meant. I never thought about looking for the tool documentation within the git documentation itself...
    – 816-8055
    Jul 11, 2022 at 8:26
29

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.

25

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.

2
  • 5
    Ah yes, this seems accurate for the options like -c, -i, --login etc. Here's the online man page. I mainly was wondering what the -i option does. --cd-to-home and --cd aren't sh commands though (neither mintty), so I guess they were added for convenience and wonder if there are more... PS: There's also C:\Program Files\Git\usr\bin\mintty.exe
    – 816-8055
    Aug 19, 2016 at 19:36
  • 2
    same for git-cmd.exe no doc and the args ConEmu passes, --no-cd and --command, have nothing to do with cmd.exe Nov 13, 2020 at 14:14
4

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

Just type bash.exe --help and it should show a screen with all options.

Example:

$ bash.exe --help

GNU bash, version 4.4.23(1)-release-(x86_64-pc-msys)
Usage:  bash [GNU long option] [option] ...
        bash [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --restricted
        --verbose
        --version
        --wordexp
Shell options:
        -ilrsD or -c command or -O shopt_option         (invocation only)
        -abefhkmnptuvxBCHP or -o option
Type `bash -c "help set"' for more information about shell options.
Type `bash -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.

bash home page: <http://www.gnu.org/software/bash>
General help using GNU software: <http://www.gnu.org/gethelp/>
2
  • 3
    "bash.exe" is a totally different executable to "git-bash-exe". The question is about the latter. You should probably delete this answer or you'll get more downvotes, if you are still around @joe mama.
    – spechter
    Oct 2, 2021 at 7:31
  • Also even the bash options are not sufficiently explained here, e.g. the -i option is not described at all (bash was what I was looking for and landed here. But I know this is not the place to discuss it.).
    – kca
    Nov 3, 2022 at 11:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .