Git CheatSheet

Looking for a handy reference guide that can help you navigate the complexities of Git version control? Our professional-grade Git Cheat Sheet is here to help! Packed with a comprehensive selection of commands, tips, and tricks, this cheat sheet makes it easy to learn the ins and outs of Git - even if you're a beginner. From the initial setup to advanced branching and merging strategies, our Git Cheat Sheet has everything you need to become an expert in no time. So why wait? Download your copy today and start mastering Git like a pro

Table of Content

# Getting started Git

What is Git ?

Git (/??t/) is software for tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development.

Its goals include speed, data integrity, and support for distributed, non-linear workflows (thousands of parallel branches running on different systems).

Installation & GUIS

With platform specific installers for Git, GitHub also provides the ease of staying up-to-date with the latest releases of the command line tool while providing a graphical user interface for day-to-day interaction, review, and repository synchronization.

GitHub for Windows

GitHub for Mac

For Linux and Solaris platforms, the latest release is available on the official Git web site.

Git for All Platforms

# Setup Git


Configuring user information used across all local repositories

Set a Name

git config --global [firstname lastname]

Set an Email

git config --global [valid-email]

Set Automatic

git config --global color.ui auto

# Setup & Init


Configuring user information, initializing and cloning repositories


git init


git clone [url]

# Stage & Snapshot


Working with snapshots and the Git staging area

Git Status

git status

Git add

git add [file]

Git Reset

git reset [file]

Git Diff

git diff

Git Diff (Staged)

git diff --staged

Git Commit

git commit -m [descriptive message]

# Branch & Merge


Isolating work in branches, changing context, and integrating changes

Git Branch

git branch

Branch Name

git branch [branch-name]

Git Checkout

git checkout

Git Merge

git merge [branch]

Git Log

git log

# Inspect & Compare in Git


Examining logs, diffs and object information

Git Log

git log

Git Log (2)

git log branchB..branchA

Git Log Follow

git log --follow [file]

Git Diff

git diff branchB...branchA

Git Show

git show [SHA]

# Tracking Path Change in Git


Versioning file removes and path changes

Git rm

git rm [file]

Git mv

git mv [existing-path] [new-path]

Git log --stat

git log --stat -M

# Ignoring Patterns in Git


Preventing unintentional staging or commiting of files



Git ignore config

git config --global core.excludesfile [file]

# Share & Update in Git


Retrieving updates from another repository and updating local repos

Git Remote

git remote add [alias] [url]

Git Fetch

git fetch [alias]

Git Merge

git merge [alias]/[branch]

Git Push

git push [alias] [branch]

Git Pull

git pull

# Rewrite History in Git


Rewriting branches, updating commits and clearing history

Git Rebase

git rebase [branch]

Git Reset

git reset --hard [commit]

# Temporary Commits in Git


Temporarily store modified, tracked files in order to change branches

Git Stash

git stash

Git Stash List

git stash list

Git Stash Pop

git stash pop

Git Stash Drop

git stash drop

Best Suggest