Flat 10% & upto 50% off + 10% Cashback + Free additional Courses. Hurry up

GIT User Handbook

This GIT cheat sheet is designed for the one who has interested and learning about the file management and using GIT as a tool, then this sheet will be a handy reference sheet. Don’t worry if you are a beginner and have no idea about how GIT works, this GIT cheat sheet will give you a quick reference of the basics that you must know to get started.

Git Cheat Sheet

What is GIT?

GIT is a tool in DevOps which is used as version-control system for tracking changes in system files and coordinating work on those files among a group of people. In the software development field, GIT is used in source-code management and track the changes in any files.

  • GIT is a distributed version control and source code management system with an emphasis on speed.
  • It is repository which is used to manage projects, set of files as they change over the time.
  • Using GIT every code change or commit you get latest development code for the project.

Watch this Git Tutorial Video

Process flow:

It shows the process flow with components used to perform certain tasks

  • Plan: It can be created or deleted by itself based on the updates in the source repository
  • Code: The statements written to perform a task in a repository
  • Shared repository: Repository which is shared among several members in order to perform the task
  • Continuous integration: It helps in updating the repository with the change made in the code and provides integration with the changes made time to time
  • Build: It is used to manually build products and dependencies to GIT
  • Configuration Management: It is a process of tracking and controlling changes in a system
  • Deploy: Pushing the code to the remote server

Process flow

Version control:

  • It is the management of changes to the code, documents, programs, large sites and other info.
  • The changes are termed as versions.
  • Version control system is used (VCS)
    • The functions are:
      • Allows developers to work simultaneously.
      • Does not allow overwriting each other’s changes.
      • Maintains a history of every version.
    • There are 2 types of VCS – centralized and distributed.
    • GIT falls under distributed

Life Cycle:

Life Cycle


  • It is a VCS that supports distributed nonlinear workflows by providing data assurance for developing quality software.
  • Features:
      • Distributed – distributed development of code
      • compatible – with existing systems and protocols
      • Non- linear- nonlinear development of code
      • Branching – easy to create and merge branches
      • Lightweight – lossless compression
      • Speed- faster than remote repository
      • Open source
      • Reliable – not viable to loss of data upon crashes
      • Secure – SHA1 and checksum are used
      • Economical – free

GIT operations and commands:

  • GIT Configurations

      • Initial config of username, email and code highlighting (optional) is to be performed.
        • $GIT config — global”firstname lastname”
        • $GIT config — global””
        • $GIT config — global color.ui true (enables code highlights)
        • $GIT config –list
  • Initialize

      • You have to initialize by using ‘init’
      • To know the status run the ‘status’ command
        • $GIT init
        • $GIT status
  • Create/Add files:

        • To add a file:
          • $GIT add<filename>
        • To add multiple files
          • $GIT add<filename> <2nd filename> <3rd filename>
        • To add all updated files
          • $GIT add –all ( use -A instead of -all too )
        • To remove files
          • $GIT rm -r <filename>
  • Commit changes:

        • To pass a message, use ‘commit’ and ‘-m’
          • $GIT commit -m “body_of_message”
        • Amend lets you amend the last commit or the last message
          • $GIT commit –amend -m “new_message”

  • Push and Pull

      • A remote repository typically represents a remote server or a GIT server.
          • Create a remote repository via GIThub “”
      • To add a link
          • $GIT remote add origin<link>
      • Pushing files
          • $GIT push -u origin master
      • To clone file
          • $GIT clone <clone>

Watch this video on DevOps Tutorial for Beginners

Branching and merging:

COMMAND Description
GIT branchList branches
GIT branch -aList all branches
GIT branch [branch name]Create a new branch
GIT branch -d [branch name]          Delete branch
GIT push origin –delete [branchName]Delete a remote branch
GIT checkout -b [branch name]Create a new branch and switch to it
GIT checkout -b [branch name] origin/[branch name]Clone a remote branch and switch to it
GIT checkout [branch name]Switch to a branch
GIT checkout –Switch to the branch last checked out
GIT checkout — [file-name.txt]Discard changes to a file
GIT merge [branch name]Merge a branch into the active branch
GIT stashStash changes in a dirty working directory
GIT stash clearRemove all stashed entries

Sharing and updating projects:

GIT push origin [branch name]Push a branch to your remote repository
GIT push -u origin [branch name]Push changes to remote repository( -u remembers the branch for next use)
GIT push origin –delete [branch name]Delete a remote branch
GIT pullUpdate local repository to the newest commit
GIT pull origin [branch name]Pull changes from remote repository
GIT remote add origin ssh://[username]/[repository-name].GITAdd a remote repository
GIT remote set-url origin ssh://[username]/[repository-name].GITSet a repository’s origin branch to SSH

Inspection and Comparison:

Command Comparison
GIT logView changes
View changesView changes (detailed)
GIT diff [source branch] [target branch}Preview changes before merging


Previous Next

Download Interview Questions asked by top MNCs in 2019?

"0 Responses on GIT Cheat Sheet"

    Leave a Message

    100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

    Sales Offer

    Sign Up or Login to view the Free GIT Cheat Sheet.