Home git Difference in using git cmd and git bash under windows

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 launch two consoles – git cmd and git bash .
My understanding is that git cmd is the windows command line and git bash is the 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 , which will make the cmd-lover start bash. The question is: which ones? For then why add an alternative to cmd to the assembly for windows?

Answer 1, authority 100%

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. Initializing environment variables (PATH, etc.)
  2. Launch terminal.

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 key --command = ... with which you can run bash instead of cmd if desired.

git.exe is a standalone program next to which all the necessary utilities from the msys package are located (for example, ls , vim , sed , and so on), and the missing utilities can be “delivered” with 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 is slightly changed, 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 above git add * .cpp 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 ) 256 colors cannot be used in Vim.

That’s probably all.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions