2011-09-05 12:19:31 -06:00
[alias]
2015-06-21 14:41:37 -06:00
aliases = "!f() { git config --get-regexp ^alias | cut -c 7-; }; f"
2015-01-02 13:24:02 -07:00
amend = commit -a --amend -C HEAD
b2h = checkout HEAD -B
branch-or-sha = "!bs() { git which-branch 2> /dev/null || git sha 2> /dev/null ; }; bs" # In newer versions of git, this simpler definition of which-branch would work. symbolic-ref HEAD --short
branches = branch -a
2011-09-05 12:19:31 -06:00
c = clone --recursive
2014-04-17 12:51:21 -06:00
ca = !git add -A && git commit -av
cam = commit -am
2015-01-02 13:24:02 -07:00
clean-branches = "!r() { git branch --merged ${1-origin/master} | grep -v '*' | xargs -n1 git branch -d; }; r"
2015-06-21 14:41:37 -06:00
clone = clone --recursive
2015-01-02 13:24:02 -07:00
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" # Credit an author on the latest commit
2015-06-29 11:50:29 -06:00
co = checkout
2015-06-21 14:41:37 -06:00
d = "!d() { git icdl $@; }; d"
2015-01-02 13:24:02 -07:00
db = !"db() { git diff HEAD~"$1"; }; db"
2015-06-21 14:41:37 -06:00
diff-excluding = "!f() { exclude=$1; shift; git diff $1 $2 --name-only | grep -v $exclude | xargs git diff "$@" --; }; f"
2015-11-02 22:17:10 -07:00
fdiff = "!f() { filter=\"$1\"; shift; git diff $1 $2 --name-only | $filter | xargs git diff "$@" --; }; f"
2014-04-17 12:51:21 -06:00
dirty = "!t() { test -n \"$(git status --porcelain)\"; }; t"
2015-01-02 13:24:02 -07:00
dtbmb = !git diff `git tb`...HEAD # diff tracking branch merge base
du = "!d() { git ls-files $1 --error-unmatch 2>/dev/null 1>/dev/null && git diff $1 || `git config --get core.pager` $1; }; d" # Diff a file or show it in git's pager if it is untracked
ff = merge --ff-only
ffo = !git ffr origin
ffr = "!ffr() { git fetch $1 && git ff $1/$(git which-branch) && git suir; }; ffr"
2015-06-21 14:41:37 -06:00
file-exists = "!f() { git ls-files $1 --error-unmatch > /dev/null 2> /dev/null; }; f"
2015-09-26 21:41:26 -06:00
force-master = "!f() { git fetch origin && git rh && git master; }; f"
2015-08-16 00:19:18 -06:00
icd = "!d() { git difftool --no-prompt --extcmd 'icdiff --cols=200' $@ | $(git config --get core.pager); }; d"
icdl = "!d() { git difftool --no-prompt --extcmd 'icdiff --line-numbers --cols=200' $@ | $(git config --get core.pager); }; d"
2014-04-17 12:51:21 -06:00
ignore = "!i() { printf \"\n$1\" >> "`git root`/.gitignore"; }; i"
2014-06-10 17:00:48 -06:00
ignore-untracked="!git untracked | xargs -n1 git ignore"
2015-01-02 13:24:02 -07:00
l = log --pretty=oneline --graph
2015-09-26 21:41:26 -06:00
master = checkout origin/master -B master
2015-01-02 13:24:02 -07:00
modified = diff HEAD --name-only
poh = push origin HEAD
pohm = push origin HEAD:master
2014-04-17 12:51:21 -06:00
power-clean = clean -ffd
2015-01-02 13:24:02 -07:00
reb = "!r() { git rebase -i HEAD~$1; }; r" # Interactive rebase with the given number of latest commits
2011-09-05 12:19:31 -06:00
remotes = remote -v
2014-06-10 17:00:48 -06:00
reset-author ="!source ~/.lib/shellrc/functions.sh && git_reset_author"
2015-01-02 13:24:02 -07:00
reset-origin = "!r() { git reset --hard origin/\"$(git which-branch)\" && git suir; }; r"
rh = reset --hard
root = rev-parse --show-toplevel
s = status -s
2015-08-07 01:49:23 -06:00
set-working-tree = "!s() { local head=\"$(git rev-parse HEAD)\"; git reset --hard $1 && git reset --soft $head; }; s"
2015-01-02 13:24:02 -07:00
sha = rev-parse HEAD
2015-08-16 23:39:23 -06:00
shas = log --pretty=format:%H
2015-01-02 13:24:02 -07:00
suir = submodule update --init --recursive
tb = rev-parse --abbrev-ref --symbolic-full-name @{u}
untracked = "!u() { git status -s | grep "??" | awk '{print $2}'; }; u"
which-branch = "!wb() { b="$(git symbolic-ref HEAD)" && echo ${b#refs/heads/}; }; wb"
2014-04-14 21:24:52 -06:00
2011-09-05 12:08:58 -06:00
[core]
2011-09-05 12:19:31 -06:00
# Use custom `.gitignore` and `.gitattributes`
excludesfile = ~/.gitignore
attributesfile = ~/.gitattributes
2015-08-15 23:49:59 -06:00
pager = pager.sh # set with environment variable so that pager can be different when inside emacs
2011-09-05 12:19:31 -06:00
2011-09-05 12:08:58 -06:00
[color]
2014-04-08 05:27:02 -06:00
# Use colors in Git commands that are capable of colored output when
2014-04-17 12:51:21 -06:00
# outputting to the terminal
2011-09-05 12:19:31 -06:00
ui = auto
2014-04-08 05:27:02 -06:00
2011-09-05 12:08:58 -06:00
[color "branch"]
2011-09-05 12:19:31 -06:00
current = yellow reverse
local = yellow
remote = green
2014-04-08 05:27:02 -06:00
2011-09-05 12:08:58 -06:00
[color "diff"]
2011-09-05 12:19:31 -06:00
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
2014-04-08 05:27:02 -06:00
2011-09-05 12:08:58 -06:00
[color "status"]
2014-09-09 21:31:27 -06:00
added = green
changed = yellow
untracked = red
2014-11-12 03:03:43 -07:00
2013-11-22 11:52:22 -07:00
[merge]
2014-04-17 12:51:21 -06:00
conflictstyle = diff3
2014-11-12 03:03:43 -07:00
2014-11-10 00:31:06 -07:00
[include]
path = ~/.gitconfig.custom
2016-08-13 18:34:15 -06:00
path = ~/.gitconfig.this-machine
2015-06-17 16:38:24 -06:00
2014-12-20 05:56:54 -07:00
[rerere]
enabled = false
2015-06-17 16:38:24 -06:00
2015-04-28 14:42:40 -06:00
[url "ssh://git@github.com/uber/"]
insteadOf = https://github.com/uber/
2015-06-17 16:38:24 -06:00
2016-03-19 04:23:11 -06:00
[url "ssh://gitolite@code.uber.internal:2222/"]
insteadOf = https://code.uber.internal/
2015-04-28 14:42:40 -06:00
[branch]
2016-03-19 04:23:11 -06:00
autosetuprebase = always