Skip to content

Instantly share code, notes, and snippets.

@neodevelop
Last active August 18, 2021 16:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neodevelop/1386338 to your computer and use it in GitHub Desktop.
Save neodevelop/1386338 to your computer and use it in GitHub Desktop.
Sharing my alias to work with git
[user]
name = Jose Juan Reyes
email = neodevelop@gmail.com
[core]
editor = vim
pager = less -FRSX
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
quotepath = false
excludesfile = /Users/makingdevs/.gitignore_global
commentChar = ";"
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
[pager]
diff = delta
log = delta
reflog = delta
show = delta
[interactive]
diffFilter = delta --color-only --features=interactive
[delta]
features = unobtrusive-line-numbers decorations
whitespace-error-style = 22 reverse
line-numbers = true
[delta "interactive"]
keep-plus-minus-markers = false
[delta "unobtrusive-line-numbers"]
line-numbers = true
line-numbers-minus-style = "#444444"
line-numbers-zero-style = "#444444"
line-numbers-plus-style = "#444444"
line-numbers-left-format = "{nm:>4}┊"
line-numbers-right-format = "{np:>4}│"
line-numbers-left-style = blue
line-numbers-right-style = blue
[delta "decorations"]
commit-decoration-style = bold yellow box ul
file-style = bold yellow ul
file-decoration-style = none
hunk-header-decoration-style = yellow box
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "status"]
added = yellow
changed = green
untracked = cyan
[apply]
whitespace = fix
[mergetool]
keepBackup = true
[merge]
tool = vimdiff
[diff]
renamelimit = 0
tool = vimdiff
[difftool]
prompt = false
[push]
default = simple
[filter "media"]
clean = git-media-clean %f
smudge = git-media-smudge %f
[alias]
st = status
au = add -u .
ci = commit
ciam = commit --amend
br = branch
co = checkout
df = diff
lg = log
lp = log -p
lt = log --topo-order
gl = log --graph
# glp = log --graph --pretty=oneline --abbrev-commit
glt = log --pretty=format:'%h : %s' --topo-order --graph
rl = reflog
sb = show-branch
brm = branch --merged
brnm = branch --no-merged
rnc = revert --no-commit
com = checkout master
hard = reset --hard
me = merge --no-commit --no-ff
ls = ls-files
pu = pull
cp = cherry-pick
cpnx = cherry-pick --no-commit -x
# show conflicting merge in gitk:
gitkconflict = !gitk --left-right HEAD...MERGE_HEAD
# prune all tracking local branches that have been removed from remote:
prune-all = !git remote | xargs -n 1 git remote prune
# show full history in gitk (including "deleted" branches and stashes)
history-all = !gitk --all $( git fsck | awk '/dangling commit/ {print $3}' )
# show list of contributors in descending order by number of commits
rank = shortlog -sn --no-merges
# given a string for an author, try to figure out full name and email:
whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
# given any git object, try to show it briefly
whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
# Search for a given string in all patches and print commit messages
# example: search for any commit that adds or removes string "foobar"
# git searchcommits foobar
# example: search commits for string "foobar" in directory src/lib
# git searchcommits foobar src/lib
# example: search commits for "foobar", print full diff of commit with 1 line context
# git searchcommits foobar --pickaxe-all -U1 src/lib
searchcommits = "!f() { query=\"$1\"; shift; git log -S\"$query\" \"$@\"; }; f \"$@\""
ds = !git --no-pager diff --stat -M -w
changes = log --oneline --reverse
# fork = !sh -c 'git rev-list --boundary $1...$2 | grep ^- | cut -c2-'
# graph = log --graph --oneline --decorate
info = config --list
pop = !git stash apply && git stash clear
staged = diff --cached
summary = log --oneline
tags = tag -n1 -l
dfdiff = diff -w --diff-filter=AM
lol = log --pretty=oneline --abbrev-commit --graph --decorate
my = log --pretty=format:'%Cred%h %C(yellow)%d %Cblue%ad%Creset %an %Cgreen%s%Creset' --graph --relative-date
dt = difftool
ltg = log --pretty=format:'%Cred%h: %Cgreen%an %C(yellow)%ar %Creset%s' --topo-order --graph
recent = "!git for-each-ref --sort=-committerdate refs/heads --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always|column -ts'|'"
sorts = "!git for-each-ref --sort=-committerdate refs/heads refs/remotes --format='%(HEAD)%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' --color=always|column -ts'|'"
[filter "lfs"]
smudge = git-lfs smudge -- %f
required = true
clean = git-lfs clean -- %f
process = git-lfs filter-process
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = red bold 52
newNormal = green bold
newHighlight = green bold 22
[color "diff"]
meta = yellow
frag = magenta bold
commit = yellow bold
old = red bold
new = green bold
whitespace = red reverse
[rerere]
enabled = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/Sourcetree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true
[gpg]
program = gpg
[pull]
ff = only
[commit]
gpgsign = false
@sublimino
Copy link

The trailing \"$@\" is not needed and breaks quoted arg passing in https://gist.github.com/neodevelop/1386338#file-gitconfig-L98

@neodevelop
Copy link
Author

Thanks for the observation!

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