This Git Cheatsheet is a quick reference guide to essential Git commands used in version control. It provides concise syntax and examples to help developers manage their code efficiently across local and remote repositories.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git config --global core.editor "vim"
git config --global color.ui auto
git config --global alias.st status
git config --list
git config --get user.email
git init
git init <directory>
git clone <url>
git clone --branch <branch> <url>
git status
git add <file>
git add . or git add --all
git commit -m "message"
git commit -a
git commit --amend
git log
git log --oneline --graph --all
git log --follow <file>
git log --author="Name"
git log --since="2 weeks ago"
git diff
git diff --staged or --cached
git diff HEAD
git diff <commit1> <commit2>
git show <commit>
git blame <file>
git branch
git branch -a
git branch -vv
git branch <name>
git branch -d <name>
git branch -r
git checkout <branch>
git checkout -b <new>
git checkout -- <file>
git merge <branch>
git rebase <branch>
git rebase -i HEAD~3
git remote -v
git remote add origin <url>
git remote rename old new
git remote remove <name>
git fetch
git fetch --prune
git pull
git pull --rebase
git push origin <branch>
git push --all
git push --tags
git stash
git stash list
git stash apply
git stash pop
git stash drop
git stash clear
git checkout -- <file>
git restore <file>
git restore --staged <file>
git reset <file>
git reset --soft <commit>
git reset --mixed <commit>
git reset --hard <commit>
git revert <commit>
git tag
git tag <name>
git tag -a <name> -m "message"
git push origin <tag>
git push origin --tags
git clean -n
git clean -f
git clean -fd
git gc
git prune
git fsck
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.