DEV Community

Cover image for Git Bash Beginner's Guide

Posted on • Updated on

Git Bash Beginner's Guide


Working on a project that requires an emulation layer for the Git command line interface would require you to know your way around using Git Bash. In this article, I will be breaking down how to install Git Bash, some Git commands you should be familiar with and how to set up a local repository with Git.


  1. What Git Bash is and how to utilize it
  2. Installing Git Bash
  3. Git Commands
  4. How to set up your local repository with Git
  5. Git Bash paste instructions
  6. Conclusion.

Image description

What is Git Bash ?

For Microsoft Windows environments, Git Bash is a program that offers an emulation layer for the Git command line interface. The abbreviation BASH stands for Bourne Again Shell. An operating system can be accessed by written commands using a shell and a terminal program. Popular default shells for Linux and macOS are bash. On a Windows operating system, Git Bash is a package that installs Bash together with a few standard bash utilities.

Installing Git Bash


Go to the official website to download the Git Bash setup:

Image description
The following window will appear once the file has been downloaded

Image description


After downloading, run the installer.


Select the components you need to install, launch the.exe file, and follow the installer's instructions.

Image description


After the installation process has finished, you can launch Git Bash either by using the cmd command on your system search or right-clicking in any folder and choosing the Git Bash Here option from the context menu.

Image description

Git Commands

  • pwd

To print the "current working directory," use the Bash command pwd. On a DOS (Windows console host) terminal, typing pwd is the equivalent of typing cd. The current Bash session is located in this folder or directory.

  • ls

To 'list' the contents of the active working directory, use the Bash command ls. On a Windows console host terminal, ls is the equivalent of DIR.
ls to list the contents of the current directory.

  • cd

The cd command in both Bash and Windows console host. Change Directory is referred to as cd. An added directory name is used when using cd. cd changes the working directory of the terminal session to the directory specified by the passed directory argument.

  • git config --global

    This comment will set your name.

  • git config --global

    This comment will set your email.

  • git init

    Create a new blank repository and initialize an existing directory as a git repository.

  • git commit

    Changes are saved to the local repository.

  • git status

    Displays the status of the working directory and the staging area.

  • git remote

    Manage the set of remotes that you are tracking with your local repository.

  • git checkout

    Match your working directory with your last commit.

  • git log

    Shows the commit history for your current active branch.

  • git pull

    Fetches and merges on the remote server to your working directory.

  • git push

    Changes the master branch to your remote repository.

  • git merge

    Merges the specific branches history into the current branch.

  • git rm

    Remove your file from your working directory and git staging area.

  • git diff

    Shows changes between commits.

  • git touch

    Creates a blank file inside your folder.

  • git add -a

    Add all modified and deleted files only to the staging area.

  • git checkout -f

    Match all your working directory file with your last commit.

  • git log -p

    See any particular "one" or more than one commit.

  • git diff --staged

    Compares the staging area to the last commit.

  • git rm --cached

    Removes your file from the staging area.

  • git branch -b

    Creates a new branch and opens that particular branch.

To Set Up Your Local Repository With Git

follow the steps below:


Make a GitHub repository.

Image description


Give your repository a good name and create the repository.

Image description

Note: You can choose to include information about your project in the README file that comes at the top of your git repository. It helps give vital information about your project. However, it is not strictly required. If you start your repository with a README file using the GitHub interface, your local repository won't have this README file. To prevent encountering an issue while attempting to push your files (as in step 3 of the following section), carry out the following steps to pull that file to your local folder after step 5 (where you setup your local folder as your git repository):

​### STEP 3

The following will show up following repository creation.

Image description


Open Git Bash and use the cd command followed by the name of the project to move to the local project.

Image description


Create a Git repository in the local directory.

Image description


Before the initial commit, stage the files by adding them to the local repository using (git add .)


The staged files can be seen with "git status"

Image description


The files you've staged in your local repository should now be committed using ( git commit -m "commit message" )

Image description
​Since there is nothing remaining to commit after running the "git status" command, all files have already been committed.

Git Bash paste instructions.


Type Ctrl+Shift+V


Consider one of the following options:

  1. Press the Insert+Shift button.

  2. Using the mouse, do the following: Right Click -> Edit -> Paste

  3. Enable the "Quick Edit" mode and use the Ctrl+V shortcut as usual:

Right-click and choose "Properties."
Choose the "Options" tab.
Check the box next to "Quick Edit Mode."
If a "Experimental" tab appears, select it and then check the top "Enable experimental console" and "Enable new Ctrl key shortcuts" options.
To save, click 'OK.'
You can now paste using Ctrl+V.


We were successful in covering Git Bash at a beginner's level and how to use it. When using Git Bash, the commands will be useful.

This has been a long read, if you made it this far then I genuinely hope you find the information useful.
I appreciate your time.

Top comments (0)