At its core, Git is a set of command-line utilities that are designed to run in a Unix-style command-line environment. Modern operating systems such as Linux and macOS include built-in Unix command-line terminals. This makes Linux and macOS complementary operating systems when working with Git. Microsoft Windows instead uses the Windows command prompt, a non-Unix terminal environment.
In Windows environments, Git is often packaged as part of higher-level GUI applications. GUIs for Git can attempt to abstract and hide the primitives of the underlying version control system. This can be a great help for Git beginners to quickly contribute to a project. Once a project’s collaboration requirements grow with other team members, it’s critical to be aware of how actual raw Git methods work. This is when it can be beneficial to remove a GUI version for command-line tools. Git Bash is offered to provide a terminal Git experience.
What is Git Bash?
Git Bash is an application for Microsoft Windows environments that provides an emulation layer for a Git command-line experience. Bash is an acronym for Bourne Again Shell. A shell is a terminal application used to interact with an operating system through typed commands. Bash is a popular default shell on Linux and macOS. Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system.
How to install
Git Bash Git
Bash is included as part of the Git package for Windows. Download and install Git For Windows like other Windows applications. Once downloaded, locate the .exe file included and open it to run Git Bash.
How to use
Git Bash
Git Bash has the same operations as a standard Bash experience. It will be useful to review the basic use of Bash. Advanced use of Bash is beyond the scope of this Git-centric document.
Navigating folders
The Bash pwd command is used to print the ‘present working directory’. pwd is equivalent to running cd in a DOS terminal (Windows console host). This is the folder or path in which the current Bash session resides.
The Bash ls command is used for ‘list’ contents of the current working directory. ls is equivalent to DIR on a Windows console host terminal.
Both Bash and the Windows console host have a cd command. cd is an acronym for ‘Change Directory’. cd is invoked with a directory name attached. Running the cd will change the current working directory of terminal sessions to the last directory argument.
Git Bash commands Git Bash
is packaged with additional commands that can be found in the /usr/bin directory of the Git Bash emulation. Git Bash can provide a fairly robust shell experience on Windows. Git Bash comes packaged with the following shell commands that are beyond the scope of this document: Ssh, scp, cat, find.
In addition to the Bash command set discussed
above, Git Bash includes the full set of core Git commands discussed on this site. Learn more on the corresponding documentation pages for git clone, git commit, git checkout, git push, and more.