Skip to content

Instantly share code, notes, and snippets.

@rajinder-yadav
Last active June 13, 2019 18:33
Show Gist options
  • Save rajinder-yadav/5776bd4f9dac7937686d6933cd0919e0 to your computer and use it in GitHub Desktop.
Save rajinder-yadav/5776bd4f9dac7937686d6933cd0919e0 to your computer and use it in GitHub Desktop.
Git Shortcuts
Alias Command Description
a add -u Add all tracked files
aa add -A . Add all files for tracking
c commit -m Commit with message
cc commit -a -m Add tracked and commit with message
ca commit --amend Commit amend
cl clone Clone repo
b branch View local branches
ba branch -a -v View all branches
bm checkout master Checkout master branch
bd checkout dev Checkout dev branch
bc checkout Create branch
bcc checkout -b Switch to branch
brm branch -D Delete branch
d difftool Show unstaged differences
dc diff --cached Show staged differences
fd fetch origin dev Fetch from origin/dev
fm fetch origin master Fetch from origin/master
f fetch origin Fetch from origin
fp fetch --all -p Fetch all branches
p pull Pull from upstream branch
po push origin Push staged changes to origin
pb push -u origin Push staged changes to origin, start tracking
pso push --set-upstream origin master Initial push set upstream tracking.
pd push origin dev Push to origin/dev
pm push origin master Push to origin/master
l log --pretty=oneline Show git short logs
ll log Show git logs
re remote -v Show all remotes
r rebase Rebase
rm rebase origin/master Rebase with origin/master
rd rebase origin/dev Rebase with origin/dev
s status Show git status
ss status -s Show git short status
spush stash push Stash push
spop stash pop Stash pop
sls stash list List all stashes
rhh reset HEAD --hard Undo changes
undo checkout -- Reload last commit of file
unstage reset HEAD Unstage commits
uncommit reset --soft HEAD~1 Undo commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment