'In the install path of Git for Windows, what's the difference between ./git-bash.exe and bin/bash.exe and bin/sh.exe?

In the install path of git for windows, I found these 3 exes:

./git-bash.exe,

./bin/bash.exe,

./bin/sh.exe,

Launching any of them would give me a usable terminal.

The 1st is the default shortcut in the start menu created by the installation, the 2nd is used in the VSCode doc for setting up the integrated terminal in VSCode, the 3rd is mentioned in the ConEmu doc.

What's the difference between them and which should I use?



Solution 1:[1]

git-bashis part of "Git for windows" and provides a command line environment similar to *nix bash.

Windows 10 includes "Windows subsystem" which could provide a Linux environment inside Windows (which includes sh and bash, a short comparison can be found at Difference between sh and bash)

You can use any of them for git. It may be an advantage to use the same as your co-workers (if you would need any help with the shell or a script).

Solution 2:[2]

The Bourne-Again Shell orbash is a super-set of sh i.e. whatever you can do in sh can also be done in bash. Bash has more features making it easier to write scripts.

On the other hand, Git bash is a msys shell included in Git for Windows since Windows natively does not support bash features (unless you add the Windows Sub-sytem for Linux).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Saikat