Skip to content

Instantly share code, notes, and snippets.

@neelabalan
Forked from architgarg/.gitconfig
Created January 15, 2024 07:52
Show Gist options
  • Save neelabalan/2c05e5c19c45754dc85ebd78904e32d5 to your computer and use it in GitHub Desktop.
Save neelabalan/2c05e5c19c45754dc85ebd78904e32d5 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment