Skip to content
si:git

Git Shortcuts

Git

By EZ4Code Team

Basic

7
ShortcutDescriptionPlatform
git initInitialize a repoall
git clone <url>Clone a repoall
git statusShow working tree statusall
git add <file>Stage a fileall
git commit -m 'msg'Commit staged changesall
git logShow commit historyall
git diffShow unstaged changesall

Branching

7
ShortcutDescriptionPlatform
git branchList branchesall
git branch <name>Create branchall
git checkout <branch>Switch branchall
git checkout -b <name>Create & switch branchall
git switch <branch>Switch branch (newer)all
git merge <branch>Merge branch into currentall
git branch -d <name>Delete branchall

Staging

7
ShortcutDescriptionPlatform
git add .Stage all changesall
git add -pStage hunks interactivelyall
git reset <file>Unstage a fileall
git resetUnstage everythingall
git restore --staged <f>Unstage (newer)all
git stashStash changesall
git stash popApply last stashall

Remote

6
ShortcutDescriptionPlatform
git remote -vList remotesall
git remote add <n> <url>Add remoteall
git fetchFetch from remoteall
git pullFetch & mergeall
git pushPush commitsall
git push -u origin <b>Push & set upstreamall

Advanced

7
ShortcutDescriptionPlatform
git rebase <branch>Rebase onto branchall
git rebase -i HEAD~3Interactive rebaseall
git reset --hard HEADDiscard all changesall
git revert <commit>Revert a commitall
git cherry-pick <c>Apply a commit elsewhereall
git reflogShow reference logall
git tag <name>Create tagall

More Shortcuts