Skip to content

Instantly share code, notes, and snippets.

@miguelbermudez
Last active September 9, 2022 00:50
Show Gist options
  • Save miguelbermudez/5dd539df93fc86048308f83dd167207f to your computer and use it in GitHub Desktop.
Save miguelbermudez/5dd539df93fc86048308f83dd167207f to your computer and use it in GitHub Desktop.
my aliases from .gitconfig
[alias]
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgb = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
lgf = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n"
lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'
log1 = log --pretty=oneline --abbrev-commit --decorate
log = log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate
ll = log --pretty=format:\"%C(yellow)%h%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --numstat
lds = log --pretty=format:\"%C(yellow)%h\\\\ %ad%Cred%d\\\\ %Creset%s%Cblue\\\\ [%cn]\" --decorate --date=short
tree = log --all --graph --decorate=short --color --format=format:'%C(bold blue)%h%C(reset) %C(auto)%d%C(reset)%x09%$
patch = !git --no-pager diff --no-color
save = !git add -A && git commit -m 'SAVEPOINT'
wip = commit -am "WIP"
undo = reset HEAD~1 --mixed
pf = push --force-with-lease
# https://haacked.com/archive/2014/07/28/github-flow-aliases/
# This commits everything in my working directory and then does a hard reset to remove that commit.
# The nice thing is, the commit is still there, but it’s just unreachable.
# Unreachable commits are a bit inconvenient to restore,
# but at least they are still there. You can run the git reflog command and find the SHA of the commit
# if you realize later that you made a mistake with the reset. The commit message will be “WIPE SAVEPOINT” in this c$
wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment