Difference in using git cmd and git bash under windows


Installed Git for Windows from https://git-scm.com/
After installation, it is possible to run two consoles – git cmd and git bash .
My understanding is that git cmd is windows command line and git bash is linux command line. The first steps in use did not reveal significant differences in the work of both. I only noticed that git bash has a convenient and rather pleasant highlighting with color, as well as hints for commands when you double-click Tab. There are probably more global differences between git cmd and git bash that will make the cmd lover run bash. The question is: which ones? For then why add an alternative to cmd to the assembly for windows?


There is no git cmd or git bash . There are only service utilities, or rather one service utility with different names: git-cmd.exe and git-bash.exe .

Both of these exes do

  1. Initialization of environment variables (PATH, etc.)
  2. Terminal launch.

There is only one difference between them – by default git-bash.exe launches mintty terminal with bash inside. git-cmd.exe launches a standard Windows terminal with cmd.exe . Moreover, git-cmd.exe has a --command=... key with which you can start bash instead of cmd if you want.

git.exe is an independent program next to which all the necessary utilities from the msys package are located (for example, ls , vim , sed , and others), and the missing utilities can be "delivered" using pacman . The alleged problem with the "paths" has no basis – all commands are performed by the git itself. git add **/*.cpp will be handled by the git itself.

Real differences:

  • From the command line cmd.exe, the syntax changes slightly, because ^ is the cmd.exe control character. For example, instead of git.exe rebase -i 2385397^1 , write git.exe rebase -i 2385397^^1 .
  • File masks like the git add *.cpp described above are not "expanded" into a file list, that is, arguments are passed unchanged and git searches for suitable files on its own. We end up with erroneous behavior when git add *.cpp adds files from subdirectories.
  • In the cmd.exe console (unless it is running in ConEmu ) you cannot use 256 colors in Vim.

That's probably all.

Scroll to Top