I have been working with Git Bash for the last two days. I know now the basic operations such as commit
, push
, pull
, fetch
, and merge
. But I still don't know what Git Bash itself actually is!
I've searched a lot about Git Bash, but all sites which I have seen focus on the functionality of its commands. I still haven't found a good answer for my question. Now, I think, I'm in the right place to get this answer!
As explained in the Bash Reference Manual, the name bash is an acronym of "Bourne-again SHell" which is a pun on Stephen Bourne, author of the Bourne shell. Bash is a superset of the earlier shell, and generally compatible with Bourne shell programs.
Git Bash is an application that provides Git command line experience on the Operating System. It is a command-line shell for enabling git with the command line in the system.
You don't need to use Git Bash. It is just conventional, because Git was developed and designed on Linux and most Git users use Linux and using Git Bash on Windows makes it a uniform experience. You can certainly use Git on cmd; just make sure you add C:\Program Files\git\cmd to your PATH .
git bash is a shell where:
sh.exe
(packaged with msysgit, as share/WinGit/Git Bash.vbs
)$HOME
is definedSee "Fix msysGit Portable $HOME
location":
On a Windows 64:
C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i"
This differs from git-cmd.bat
, which provides git commands in a plain DOS command prompt.
A tool like GitHub for Windows (G4W) provides different shell for git (including a PowerShell one)
Update April 2015:
Note: the git bash in msysgit/Git for windows 1.9.5 is an old one:
GNU bash, version 3.1.20(4)-release (i686-pc-msys) Copyright (C) 2005 Free Software Foundation, Inc.
But with the phasing out of msysgit (Q4 2015) and the new Git For Windows (Q2 2015), you now have Git for Windows 2.3.5.
It has a much more recent bash, based on the 64bits msys2 project, an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software. msys2
comes with its own installer too.
The git bash is now (with the new Git For Windows):
GNU bash, version 4.3.33(3)-release (x86_64-pc-msys) Copyright (C) 2013 Free Software Foundation, Inc.
Original answer (June 2013) More precisely, from msygit wiki:
Historically, Git on Windows was only officially supported using Cygwin.
To help make a native Windows version, this project was started, based on the mingw fork.To make the milky 'soup' of project names more clear, we say like this:
- msysGit - is the name of this project, a build environment for Git for Windows, which releases the official binaries
- MinGW - is a minimalist development environment for native Microsoft Windows applications.
It is really a very thin compile-time layer over the Microsoft Runtime; MinGW programs are therefore real Windows programs, with no concept of Unix-style paths or POSIX niceties such as afork()
call- MSYS - is a Bourne Shell command line interpreter system, is used by MinGW (and others), was forked in the past from Cygwin
- Cygwin - a Linux like environment, which was used in the past to build Git for Windows, nowadays has no relation to msysGit
So, your two lines description about "git bash" are:
"Git bash
" is a msys shell included in "Git for Windows", and is a slimmed-down version of Cygwin (an old version at that), whose only purpose is to provide enough of a POSIX layer to run a bash.
Reminder:
msysGit is the development environment to compile Git for Windows. It is complete, in the sense that you just need to install msysGit, and then you can build Git. Without installing any 3rd-party software.
msysGit is not Git for Windows; that is an installer which installs Git -- and only Git.
See more in "Difference between msysgit and Cygwin + git?".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With