Skip to content

Instantly share code, notes, and snippets.

@nidble
Last active August 10, 2023 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nidble/d2fb00d5929fb6b4eac00481e2b9d5b6 to your computer and use it in GitHub Desktop.
Save nidble/d2fb00d5929fb6b4eac00481e2b9d5b6 to your computer and use it in GitHub Desktop.
My git config <3
[user]
#git config --global alias.lol "log --oneline --graph --decorate"
email = xxxxx
name = XXX XXX
[core]
editor = vim
pager = diff-so-fancy | less --tabs=4 -RFX
[alias]
purge = !git branch -D $1 && git push origin :$1
lasts = !git branch --sort=-committerdate
g = grep --break --heading --line-number
# ref: http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
ls = 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
#nocolors
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
logtree = log --graph --oneline --decorate --all
lol = log --oneline --graph --decorate
track = checkout --track
[grep]
extendRegexp = true
lineNumber = true
[core]
# pager = diff-so-fancy | less --tabs=4 -RFX
editor = vim
[user]
#email = antonino.bertulla@foo.bar
email = abertulla@bar.foo
name = Antonino Bertulla
[color]
ui = true
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = 11
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[icdiff]
options = --highlight --line-numbers
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
more = "! for ref in $(git for-each-ref --format='%(refname:short)' | grep 'origin/'); do git --no-pager log $ref -n 1; done"
wip = for-each-ref --sort='authordate:iso8601' --format=' %(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads
# https://stackoverflow.com/questions/2919878/git-rewrite-previous-commit-usernames-and-emails/2920001
change-commits = "!f() { VAR1=$1; VAR='$'$1; OLD=$2; NEW=$3; echo \"Are you sure for replace $VAR $OLD => $NEW ?(Y/N)\";read OK;if [ \"$OK\" = 'Y' ] ; then shift 3; git filter-branch --env-filter \"if [ \\\"${VAR}\\\" = '$OLD' ]; then export $VAR1='$NEW';echo 'to $NEW'; fi\" $@; fi;}; f "
# https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
git for-each-ref --sort=-committerdate refs/heads/
# https://stackoverflow.com/questions/10349302/how-to-git-log-from-all-branches-for-the-author-at-once
git log --pretty=format:"%ad:%an:%d:%B" --date=short --reverse --all --since=6.months.ago --author="Mario Rossi"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment