137 lines
4.3 KiB
Plaintext
137 lines
4.3 KiB
Plaintext
# gitconfig
|
|
[user]
|
|
name = Nick Nisi
|
|
email = nick@nisi.org
|
|
[github]
|
|
user = nicknisi
|
|
[init]
|
|
templatedir = ~/.dotfiles/git/templates
|
|
[alias]
|
|
# meta
|
|
# list all aliases
|
|
la = "!git config -l | grep alias | cut -c 7-"
|
|
delete-merged-branches = "!f() { git checkout --quiet master && git branch --merged | grep --invert-match '\\*' | xargs -n 1 git branch --delete; git checkout --quiet @{-1}; }; f"
|
|
diff = diff --ignore-space-at-eol -b -w --ignore-blank-lines
|
|
cnv = commit --no-verify
|
|
co = checkout
|
|
s = status --short
|
|
ss = status
|
|
br = branch -v
|
|
brt = "!sh -c gbrt"
|
|
# show a pretty log graph
|
|
lg = log --graph --pretty=oneline --abbrev-commit --decorate
|
|
# slight variation of pretty log graph
|
|
l = log --graph --pretty=format:'%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
|
|
# list all aliases
|
|
la = "!git config -l | grep alias | cut -c 7-"
|
|
# show files that have changed between two branches (git dbr master..branch)
|
|
dbr = diff --name-status
|
|
# show diff of cached files
|
|
gdc = diff --cached
|
|
# show changed files for a commit
|
|
cf = show --pretty="format:" --name-only
|
|
# undo a commit
|
|
undo = reset --soft
|
|
# show what I did today
|
|
day = "!sh -c 'git log --reverse --no-merges --branches=* --date=local --after=\"yesterday 11:59PM\" --author=\"`git config --get user.name`\"'"
|
|
|
|
# assume aliases
|
|
assume = update-index --assume-unchanged
|
|
unassume = update-index --no-assume-unchanged
|
|
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
|
|
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
|
|
|
|
# tag aliases
|
|
lt = describe --tags --abbrev=0
|
|
|
|
fixup = !sh -c 'git commit --fixup=$1' -
|
|
squash = !sh -c 'git commit --squash=$1' -
|
|
ri = rebase --interactive --autosquash
|
|
|
|
# stash shortcuts
|
|
sp = stash pop
|
|
sw = stash save
|
|
sl = stash list
|
|
sh = show --pretty="format:" --name-only
|
|
|
|
# submodule shortcuts
|
|
si = submodule init
|
|
su = submodule update
|
|
|
|
# show number of commits per contributer, sorted
|
|
count = shortlog -sn
|
|
|
|
undo = reset --soft HEAD~1
|
|
amend = commit --amend -C HEAD
|
|
|
|
cleanup = "!git remote prune origin && git gc && git clean -df && git stash clear"
|
|
|
|
# rebase the current branch with changes from upstream remote
|
|
update = !git fetch upstream && git rebase upstream/`git rev-parse --abbrev-ref HEAD`
|
|
|
|
# tag aliases
|
|
# show the last tag
|
|
lasttag = describe --tags --abbrev=0
|
|
|
|
# assume aliases
|
|
assume = update-index --assume-unchanged
|
|
unassume = update-index --no-assume-unchanged
|
|
assumed = "!git ls-files -v | grep ^h | cut -c 3-"
|
|
unassumeall = "!git assumed | xargs git update-index --no-assume-unchanged"
|
|
|
|
# grep commands
|
|
|
|
# 'diff grep'
|
|
dg = "!sh -c 'git ls-files -m | grep $1 | xargs git diff' -"
|
|
# diff grep changes between two commits
|
|
dgc = "!sh -c 'git ls-files | grep $1 | xargs git diff $2 $3 -- ' -"
|
|
# 'checkout grep'
|
|
cg = "!sh -c 'git ls-files -m | grep $1 | xargs git checkout ' -"
|
|
# add grep
|
|
ag = "!sh -c 'git ls-files -m -o --exclude-standard | grep $1 | xargs git add' -"
|
|
# add all
|
|
aa = !git ls-files -d | xargs git rm && git ls-files -m -o --exclude-standard | xargs git add
|
|
# remove grep - Remove found files that are NOT under version control
|
|
rg = "!sh -c 'git ls-files --others --exclude-standard | grep $1 | xargs rm' -"
|
|
[color]
|
|
diff = auto
|
|
status = auto
|
|
branch = auto
|
|
interactive = auto
|
|
ui = auto
|
|
[color "branch"]
|
|
current = green bold
|
|
local = green
|
|
remote = red bold
|
|
[color "diff"]
|
|
meta = yellow bold
|
|
frag = magenta bold
|
|
old = red bold
|
|
new = green bold
|
|
[color "status"]
|
|
added = green bold
|
|
changed = yellow bold
|
|
untracked = red
|
|
[color "sh"]
|
|
branch = yellow
|
|
[push]
|
|
# push will only do the current branch, not all branches
|
|
default = current
|
|
[branch]
|
|
# set up 'git pull' to rebase instead of merge
|
|
autosetuprebase = always
|
|
[diff]
|
|
renames = copies
|
|
mnemonicprefix = true
|
|
[difftool]
|
|
prompt = false
|
|
[apply]
|
|
# do not warn about missing whitespace at EOF
|
|
whitespace = nowarn
|
|
[core]
|
|
excludesfile = ~/.gitignore_global
|
|
pager = less -FXRS -x2
|
|
editor = vim
|
|
[rerere]
|
|
enabled = true
|