Skip to content

Instantly share code, notes, and snippets.

@kidpixo
Last active January 23, 2023 09:34
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 kidpixo/51fc7ac794bdd8a83dde2c66b34abb1a to your computer and use it in GitHub Desktop.
Save kidpixo/51fc7ac794bdd8a83dde2c66b34abb1a to your computer and use it in GitHub Desktop.
my .gitconfig
[core]
excludesfile = $HOME/.gitignore_global
editor = vim
# pager = delta
[filter "media"]
required = true
clean = git media clean %f
smudge = git media smudge %f
[push]
default = simple
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --decorate
ignore = "!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi"
alias = "!git config --get-regexp alias | cut -d'.' -f 2- | sort"
dn=diff --name-only
dnh=diff --name-only HEAD~
# from [The Ultimate Git Alias Setup](https://gist.github.com/mwhite/6887990)
a = add
al = add --all
afzf = "!git ls-files -m -o --exclude-standard | fzf --print0 -m | xargs -0 -t -o git add; git status"
# add patch
ap = add -p
c = commit --verbose
# committ all
ca = commit -a --verbose
cm = commit --verbose -m
cam = commit --verbose -a -m
m = commit --amend --verbose
s = status
ss = 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/--'"
stl="stash list"
ps=push
pl=pull
f= fetch
alcm = "!f() { git add --all; git commit --verbose -a -m \"$1\";}; f"
acp = "!f() { git add --all; git commit --verbose -a -m \"$1\"; git push;}; f"
showtool = "!showci() { rev=${1:-HEAD}; git difftool $rev~1 $rev; }; showci $1"
re = remote
rev = remote -vv
br = branch
brv = branch -vv --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) %(color:blue)[%(upstream:short)]%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
# verbose list branches, sorted by last commit and show it.
brvt = branch -vv --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) %(color:blue)[%(upstream:short)]%(color:reset) - %(color:red)%(objectname:short)%(color:reset) - %(contents:subject) - %(authorname) (%(color:green)%(committerdate:relative)%(color:reset))'
brmt = "! for branch in `git branch -r | grep -v HEAD`;do echo `git show --format=\"%ci %cr\" $branch | head -n 1` \\t$branch; done | sort -r"
# git Tag Graph
tg= log --date-order --graph --tags --pretty=format:'%ai %h %d'
# git Tag Graph Simplify
tgs= log --tags --no-walk --date=iso-local --pretty='%C(auto)%h %cd%d %s'
usrkid = "!git config user.name kidpixo; git config user.email kidpixo@gmail.com"
root = "!f() { cd $(git rev-parse --show-toplevel);pwd;}; f"
editconfig="!f() { vim $(git rev-parse --show-toplevel)/.git/config; }; f"
editrootingore="!f() { vim $(git rev-parse --show-toplevel)/.gitignore; }; f"
[color]
ui = auto
[difftool]
prompt = false
[diff]
tool = vimdiff
[delta]
plus-style = "syntax #012800"
minus-style = "syntax #340001"
syntax-theme = Monokai Extended
navigate = true
[commit]
# sh extension to use shell syntaxt hilight
# use ~ instead $HOME, see [Git - git-config Documentation](https://git-scm.com/docs/git-config)
template = ~/.gitTemplateCommitMsg.sh
[diff "jupyternotebook"]
command = git-nbdiffdriver diff
[merge "jupyternotebook"]
driver = git-nbmergedriver merge %O %A %B %L %P
name = jupyter notebook merge driver
[difftool "nbdime"]
cmd = git-nbdifftool diff \"$LOCAL\" \"$REMOTE\" \"$BASE\"
[mergetool "nbdime"]
cmd = git-nbmergetool merge \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
[mergetool]
prompt = false
[cola]
spellcheck = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment