Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
260 lines (241 sloc) 8.3 KB
[user]
name = Wesley Bland
email = wesley.bland@intel.com
[color]
diff = auto
status = auto
branch = auto
ui = auto
# optional, but helps to distinguish between
# changed and untracked files
[color "status"]
added = green
changed = red
untracked = magenta
# optional, but allows git to create 8-character abbreviated hashes, that are "trac-compatible" for automatic link generation in the comments.
[core]
whitespace = blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent
abbrev = 12
excludesfile = /home/wbland/.gitignore
pager = diff-so-fancy | less --tabs=4 -RFX
[pull]
rebase = true
# optional, but allows better view of commits
[alias]
graph = log --graph --decorate --abbrev-commit --pretty=oneline
sed = ! git grep -l '.' | xargs sed -i -e
# Amend, reusing the commit message.
autoamend = commit -a --amend -CHEAD
######################################################################
# Clean up whitespace.
#
# See
# http://stackoverflow.com/questions/591923/make-git-automatically-remove-trailing-whitespace-before-committing/15398512#15398512
######################################################################
# Check that it's safe to fix whitespace.
#
# Called by whitespace fixers below.
fixws-is-safe = !"\
if [ -d \"$(git rev-parse --git-dir)/rebase-merge\" ] ; then \
echo \"Rebase in progress; can't 'git fixws'!\" ; \
false ; \
fi"
# Fix whitespace in the index while preserving a dirty tree, if
# any.
#
# Assuming your index is empty, some useful variations are:
#
# - fix whitespace in all changes in all versioned files:
#
# git add -u :/ && git fixws && git reset
#
# - fix whitespace in all unversioned files and in all changes in
# all versioned files:
#
# git add --all :/ && git fixws && git reset
#
# Logic:
#
# The 'git stash save' fails if the tree is clean (instead of
# creating an empty stash :P). So, we only 'stash' and 'pop' if
# the tree is dirty.
#
# The 'git rebase --whitespace=fix HEAD~' throws away the commit
# if it's empty, and adding '--keep-empty' prevents the whitespace
# from being fixed. So, we first check that the index is dirty.
#
# Also:
# - '(! git diff-index --quiet --cached HEAD)' is true (zero) if
# the index is dirty
# - '(! git diff-files --quiet .)' is true if the tree is dirty
#
# The 'rebase --whitespace=fix' trick is from here:
# http://stackoverflow.com/a/19156679/470844
fixws = !"\
git fixws-is-safe && \
if (! git diff-files --quiet .) && \
(! git diff-index --quiet --cached HEAD) ; then \
git commit -m FIXWS_SAVE_INDEX && \
git stash save FIXWS_SAVE_TREE && \
git rebase --whitespace=fix HEAD~ && \
git stash pop && \
git reset --soft HEAD~ ; \
elif (! git diff-index --quiet --cached HEAD) ; then \
git commit -m FIXWS_SAVE_INDEX && \
git rebase --whitespace=fix HEAD~ && \
git reset --soft HEAD~ ; \
fi"
# Fix whitespace in the index and the tree.
#
# Precede with 'git add -N <files>' to also fix whitespace in
# unversioned files <files>.
#
# Logic:
#
# The different cases are:
# - dirty tree and dirty index
# - dirty tree and clean index
# - clean tree and dirty index
#
# We have to consider separate cases because the 'git rebase
# --whitespace=fix' is not compatible with empty commits (adding
# '--keep-empty' makes Git not fix the whitespace :P).
fixws-global-tree-and-index = !"\
git fixws-is-safe && \
if (! git diff-files --quiet .) && \
(! git diff-index --quiet --cached HEAD) ; then \
git commit -m FIXWS_SAVE_INDEX && \
git add -u :/ && \
git commit -m FIXWS_SAVE_TREE && \
git rebase --whitespace=fix HEAD~2 && \
git reset HEAD~ && \
git reset --soft HEAD~ ; \
elif (! git diff-files --quiet .) ; then \
git add -u :/ && \
git commit -m FIXWS_SAVE_TREE && \
git rebase --whitespace=fix HEAD~ && \
git reset HEAD~ ; \
elif (! git diff-index --quiet --cached HEAD) ; then \
git commit -m FIXWS_SAVE_INDEX && \
git rebase --whitespace=fix HEAD~ && \
git reset --soft HEAD~ ; \
fi"
# Fix whitespace in the index and the tree.
#
# BROKEN: Does not work because the 'git rebase --whitespace=fix'
# is not compatible with empty commits (adding '--keep-empty'
# makes Git not fix the whitespace :P).
#
# fixws-global-tree-and-index =!\
# git commit --allow-empty -m FIXWS_SAVE_INDEX && \
# git add -u :/ && \
# git commit --allow-empty -m FIXWS_SAVE_TREE && \
# git rebase --whitespace=fix --keep-empty HEAD~2 && \
# git reset HEAD~ && \
# git reset --soft HEAD~
# Fix whitespace in local-tree files (sub-tree rooted at current
# dir). Fail gracefully if the index is dirty.
#
# The if-statements:
# - if index is clean
# - if tree is dirty
fixws-local-tree =!"\
cd \"$GIT_PREFIX\" && \
if git diff-index --quiet --cached HEAD ; then \
if ! git diff-files --quiet . ; then \
export GIT_EDITOR=: && \
git -c apply.whitespace=fix add -ue . && \
git checkout . && \
git reset ; \
fi ; \
else \
echo 'Your index is dirty! Bailing ...' >&2 && exit 1 ; \
fi"
# Fix whitespace in indexed files. Fail gracefully if the tree is
# dirty.
#
# We 'cd' to the top-level so that commands are relative the whole
# tree.
#
# The if-statements:
# - if tree is clean
# - if index is dirty
fixws-index =!"\
cd `git rev-parse --show-toplevel` && \
if git diff-files --quiet . ; then \
if ! git diff-index --quiet --cached HEAD ; then \
export GIT_EDITOR=: && \
git reset && \
git -c apply.whitespace=fix add -ue . && \
git checkout . ; \
fi ; \
else \
echo 'Your tree is dirty! Bailing ...' >&2 && exit 1 ; \
fi"
# Fix whitespace in the index and the local tree (sub-tree rooted
# at current dir).
#
# The complicated sequencing in the first branch: hide the index
# while fixing the tree, and then hide the tree while fixing the
# index. The 'git stash' is necessary if there are any
# non-indexed changes (not just in the current sub-tree, hence the
# `git rev-parse --show-toplevel`), but fails to create a stash if
# there are no non-indexed changes.
#
# Can't use 'git stash --keep-index' to save the tree first and
# avoid the 'git commit', since 'git stash' still stashes the
# indexed changes in this case, and so fixing whitespace errors in
# the index causes a conflict on 'git stash pop'.
fixws-local-tree-and-index =!"\
cd \"$GIT_PREFIX\" && \
if (! git diff-files --quiet `git rev-parse --show-toplevel`) && \
(! git diff-index --quiet --cached HEAD) ; then \
git commit --allow-empty -m FIXWS_SAVE_INDEX && \
git fixws-local-tree && \
git stash save FIXWS_SAVE_TREE && \
git reset --soft 'HEAD^' && \
git fixws-index && \
git stash pop ; \
elif (! git diff-files --quiet .) ; then \
git fixws-local-tree ; \
elif (! git diff-index --quiet --cached HEAD) ; then \
git fixws-index ; \
fi"
[push]
default = simple
[diff]
renames = copies
mnemonicprefix = true
compactionHeuristic = true
[hub]
host = github.intel.com
[fetch]
prune = true
[filter "lfs"]
clean = git-lfs clean %f
smudge = git-lfs smudge %f
required = true
[pager]
log = diff-so-fancy | less --tabs=4 -RFX
show = diff-so-fancy | less --tabs=4 -RFX
diff = diff-so-fancy | less --tabs=4 -RFX
[interactive]
diffFilter = diff-so-fancy | less --tabs=4 -RFX
[color]
ui = always
[color "diff"]
meta = yellow bold
commit = green bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "diff-highlight"]
oldNormal = red bold
oldHighlight = "red bold 52"
newNormal = "green bold"
newHighlight = "green bold 22"
[github]
user = wesbland
[credential]
helper = store