Skip to content

Instantly share code, notes, and snippets.

@BeckmaR
Last active April 29, 2022 09:32
Show Gist options
  • Save BeckmaR/0ca610dcca2dc3b35cf1e8f3d8e8b787 to your computer and use it in GitHub Desktop.
Save BeckmaR/0ca610dcca2dc3b35cf1e8f3d8e8b787 to your computer and use it in GitHub Desktop.
git-aliases
[alias]
# one-line log
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
a = add
au = add -u
ap = add -p
c = commit --verbose
ca = commit -a --verbose
cm = commit -m
cam = commit -a -m
m = commit --amend --verbose
mq = commit --amend --verbose --no-edit --no-verify
p = push
pf = push --force
psu = "!git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)"
rHh = reset HEAD --hard
r = reset *
cdf = clean -df
kill = "!sure && git rHh && git cdf"
d = diff
ds = diff --stat
dc = diff --cached
s = status -s
co = checkout
cob = checkout -b
# list branches sorted by last modified
b = "!git for-each-ref --sort='-authordate' --format='%(authordate)%09%(objectname:short)%09%(refname)' refs/heads | sed -e 's-refs/heads/--'"
# list aliases
la = "!git config -l | grep alias | cut -c 7-"
com = "!git fetch && git co main && git pull"
rbc = rebase --continue
rbi = "!f() { git rebase -i HEAD~$1 ; }; f"
rbim = rebase -i main
rbm = "!f() { n='git rev-list --count HEAD ^master'; git rebase -i HEAD~$n ; }; f"
[rebase]
autosquash = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment