For windows system, Git provides a BASH emulation to run Git from the command line.
We can start it by double clicking on <git-installation-directory>/git-bash.exe
What is Git Bash emulation?
Above screenshot shows the title MINGW64. It is short for Minimalist GNU for Windows 64 bits. It provides open source programming tool set for windows system. It can be thought as an alternative to Cygwin. MINGW64 also includes MSYS2 which provides a bash shell. Above shells actually runs in a Mintty terminal window. In window right click > Options > About...
Opening from Windows explorer
Opening within cmd
We can invoke either sh.exe or bash.exe which reside in <git-installation-directory>/bin/ directory:
I prefer to use Mintty window (git-bash.exe) as it's easier to copy/paste/search via right click menu there.
Autocompletion for git
Git bash by default provides autocompletion for git commands:
Joe@jpc MINGW64 /d/example-project (master)
$ git staTabTab
stage stash status
Joe@jpc MINGW64 /d/example-project (master)
$ git sta_
If you don't have the autocompletion support, get the source code of git-completion.bash from here, save that in your home directory and add this to your .bashrc (home directory or your custom location):
source ~/git-completion.bash
Autocompletion also works with command's options:
Joe@jpc MINGW64 /d/example-project (master)
$ git --TabTab
--bare --html-path --no-replace-objects
--exec-path --info-path --paginate
--exec-path= --man-path --version
--git-dir= --namespace= --work-tree=
--help --no-pager
Joe@jpc MINGW64 /d/example-project (master)
$ git --_
Joe@jpc MINGW64 /d/example-project (master)
$ git init --TabTab
--bare --quiet --template=
--no-... --separate-git-dir=
--no-template --shared
Joe@jpc MINGW64 /d/example-project (master)
$ git init --_
Joe@jpc MINGW64 /d/example-project (master)
$ git init --sTabTab
--separate-git-dir= --shared
Joe@jpc MINGW64 /d/example-project (master)
$ git init --s_
Other features
Git bash for windows also informs us if we are in a working branch by showing the branch name in parentheses. The last screenshots above show (master) in cyan color.
If you are in git repository folder then it shows (GIT_DIR!):
Joe@jpc MINGW64 /d/example-project (master)
$ cd .git
Joe@jpc MINGW64 /d/example-project/.git (GIT_DIR!)
$_
|