Skip to content

Instantly share code, notes, and snippets.

@architgarg
Last active January 15, 2024 07:52
Show Gist options
  • Save architgarg/4155c0888004ec625ede75a0d826f9f3 to your computer and use it in GitHub Desktop.
Save architgarg/4155c0888004ec625ede75a0d826f9f3 to your computer and use it in GitHub Desktop.
Awesome git aliases - [For Medium Article]
[alias]
br = branch
st = status -s -b
lg = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative -20
ac = !git add -A && git commit -m
oops = !git add -A && git commit --amend --no-edit
unstash = stash pop
bd = branch -D
ch = checkout
chb = checkout -b
cht = checkout -t
current = rev-parse --abbrev-ref HEAD
pto = !CURRENT=$(git current) && git push origin $CURRENT
pfo = !CURRENT=$(git current) && git pull origin $CURRENT
rh = "!f() { \
git reset --hard HEAD~$1; \
}; f"
rs = "!f() { \
git reset --soft HEAD~$1; \
}; f"
rsh = "!f() { \
git reset --soft $1; \
}; f"
rhh = "!f() { \
git reset --hard $1; \
}; f"
rhH = !git add -A && reset --hard HEAD
@architgarg
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment