Git Command Cheat Sheet & Quick Reference
Git Command Cheat Sheet & Quick Reference
Git Command Cheat Sheet & Quick Reference
This cheat sheet summarizes commonly used Git command line instructions for quick reference.
# Getting Started
Create a Repository
Clone a repository
Make a change
Show modified files in working directory, staged for your next commit
$ git status
Stages the file, ready for commit
$ git add .
$ git diff
Configuration
Set the name that will be attached to your commits and tags
Set an email address that will be attached to your commits and tags
$ git branch
$ git log
Synchronize
Fetch and merge any commits from the tracking remote branch
$ git pull
Merge just one specific commit from another branch to your current branch
$ it h i k [ it id]
Remote
$ git remote -v
Temporary Commits
$ git stash
Delete the file from project and stage the removal for commit
$ git rm [file]
Show all commit logs with indication of any paths that moved
Ignoring Files
/logs/*
# Git Tricks
Rename branch
Renamed to new_name
Log
Branch
$ git checkout -
$ git branch -r
Rewriting history
Git Aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
Top Cheatsheet