GIT Cheat Sheet – A list of commonly used GIT commands [Bookmark]

 In All Tutorials
Last Updated On August 02, 2019

Today most of the developers manage their projects using Git, a distributed version control system that supports collaboration. The objective of this Git Cheat Sheet Guide is to provide you a quick reference to commands which you can bookmark and use while working and collaborating in any Git repository.

GIT BASICS

Command Description
git init
Create empty repo. Details
git clone <repo>
Clone existing repo. Details
git add <filename>
git add *
Stage all changes. Details
git commit -m "<message>"
Commit changes with a message. Details
git status
List staged/unchanged/untracked. Details
git log
Display commit history. Details
git diff
Show unstaged changes. Details

GIT BRANCHES

Command Description
git branch
List branches. Details
git branch <branch> 
Create a new branch. Details
git branch -D <branch> 
Danger Command Delete a branch. Details
git checkout <branch>
Checkout existing branch. Details
git merge <branch>
Merge a branch into the current branch. Details

LOCAL & REMOTE MODIFICATIONS

Command Description
git stash
Save modified + staged changes. Details
git reset <file>
Remove the file from staging. Details
git revert <commit>
Create a new commit, reverting a previous commit's changes. Details
git rebase <branch>
Combine the last commit + staged changes. Details
git reset --hard <commit>
Danger Command Clear stagging area, rewrite working tree. Details

SHARE & UPDATE

Command Description
git remote add <alias> <url>
Add git URL as an alias. Details
git fetch <alias>
Fetch all remote branches. Details
git merge <alias>/<branch>
Merge remote into the current branch. Details
git push <alias> <branch>
Push local commits to a remote repo. Details
git pull
Fetch + merge remote commits. Details
git rm
Danger Command Remove files from the working tree and from the index. Details
git remote set-url
Changes URLs for the remote. Sets first URL for remote that matches regex (first URL if no is given) to . If doesn’t match any URL, an error occurs and nothing is changed. Details

We request you to bookmark this Page as more Such Commands and Descriptions are coming your Way.

Thank you for Reading and Happy Coding!

Recent Posts
Comments
  • Dan
    Reply

    Bookmarked in my evernote!

Leave a Comment

We are always looking for fresh talent to contribute to our blog. If you have a knack for writing and a passion for email marketing, we would love to have your post on our Guest Blog .

Submit a Guest Post
Pepi thinking

Start typing and press Enter to search

Thank you for your details!

Fill out your information below, and we will send you a PepiAlert, that will describe your domain’s email deliverability situation. Please note that your email address must match the domain, or the domain must be owned by the company matching the email address. We have the right to refuse the request, if we can’t verify the information.

*All fields are required



Pin It on Pinterest