Show Menu


git clone
Clone an existing repository
git init
Clone a local repository
git add
Add files to staging
git commit
Commit staged changes to the repository
git commit --amend
Reword the last commit message
git mv
Move or rename a file
git rm
Unstage files


git branch
Lists all branches
git checkout <br­anc­h>
Switches to a new branch
git checkout -b <br­anc­h>
Creates the new branch while also switching to it
git branch -d <br­anc­h>
Deletes the branch
git merge <br­anc­h>
Merges current branch into <br­anc­h>


git remote -v
List remotes
git remote add <pa­th>
Adds a new remote
git fetch
Get the latest changes from origin
git pull
Get the latest changes and merge
git push
Publish local changes to the repository
git push <re­mot­e> :<b­ran­ch>
Deletes remote branch
git reset --hard HEAD
Undo local commits

git rebase and cherry pick

git rebase <br­anc­h>
Takes the current branch's commits and applies them on top of another base
git rebase -i
Changing commits in ways such as editing, deleting or squashing
git rebase --continue
Staging files changes during intera­ctive rebase
git rebase --abort
Terminates the process
git cherry­-pick <co­mmi­t>
Choose commits from one branch and apply it onto another

git bisect

git bisect start
Begins the bisect process
git bisect good/bad <ta­g>
Marks <ta­g> as a broken or working version
git bisect good/bad
Marks the commit as good or bad
git bisect reset
Ends the bisect process

git log

git reflog
Displays an ordered list of the commits that HEAD has pointed to
git log--<­lim­it>
Limit the number of commits displayed
git log --oneline
Limit each commit to a single line
git log --stat
Shows the file(s) that have been modified, the number of lines that have been added or removed and also displays a summary line
git log --grep­="<p­att­ern­>"
Search for a specific word/p­hrase in a list of commits
git log --auth­or=­"­<au­tho­r>"
Display all commits by an author
git log -- <fi­le>
Only show commits in a certain file
git log --merges
Display a log with only merge commits
git shortlog
Group commits by their authors
git diff
View the difference between two commits


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Git Cheat Sheet