Git Cheat Sheet

Live

Common git commands and usage.

Git Cheat Sheet

A quick reference for common Git commands.

git initBasics

Initialize a new Git repository

git clone [url]Basics

Clone a repository into a new directory

git statusBasics

Show the working tree status

git add .Basics

Add all changes to staging area

git commit -m '[msg]'Basics

Record changes to the repository

git branchBranching

List, create, or delete branches

git checkout [branch]Branching

Switch branches or restore working tree files

git checkout -b [branch]Branching

Create and switch to a new branch

git merge [branch]Merging

Join two or more development histories together

git remote -vRemote

List remote repositories

git fetchRemote

Download objects and refs from another repository

git pullRemote

Fetch from and integrate with another repository or a local branch

git pushRemote

Update remote refs along with associated objects

git logAdvanced

Show commit logs

git diffAdvanced

Show changes between commits, commit and working tree, etc

git stashAdvanced

Stash the changes in a dirty working directory away

git reset --hardAdvanced

Reset current HEAD to the specified state

First Class Micro SaaS