AppGit › Linux

Git Linux Shortcuts

32 shortcuts · View all OS →

WindowsmacOSLinuxCompare all
ActionLinux Shortcut
Setup & Init
git initgitinit
git clone <url>gitclone<url>
git config --global user.namegitconfig--globaluser.name
git config --global user.emailgitconfig--globaluser.email
Staging & Committing
git statusgitstatus
git add <file>gitadd<file>
git add . (stage all)gitadd.
git commit -m "msg"gitcommit-m"msg"
git commit --amendgitcommit--amend
git reset HEAD <file> (unstage)gitresetHEAD<file>
git diff (unstaged changes)gitdiff
git diff --stagedgitdiff--staged
Branches
git branch (list)gitbranch
git branch <name> (create)gitbranch<name>
git checkout <branch>gitcheckout<branch>
git checkout -b <branch> (create+switch)gitcheckout-b<branch>
git merge <branch>gitmerge<branch>
git branch -d <branch> (delete)gitbranch-d<branch>
git rebase <branch>gitrebase<branch>
Remote
git remote -v (list remotes)gitremote-v
git fetchgitfetch
git pullgitpull
git pushgitpush
git push -u origin <branch>gitpush-uorigin<branch>
git push --force-with-leasegitpush--force-with-lease
Log & History
git loggitlog
git log --onelinegitlog--oneline
git log --graph --onelinegitlog--graph--oneline
git show <commit>gitshow<commit>
git stashgitstash
git stash popgitstashpop
git reset --hard HEADgitreset--hardHEAD