Yes, this is possible since Git 1.7.10 :
[include]
path = path/to/the/other/gitConfigurationFile
This comes with some instructions :
- the expansion of $HOME is not supported
- ~ is supported since Git 1.7.10.2
- relative paths are relative to the file having the
[include]
statement
- chaining
[include]
s is permitted
- files not found are silently ignored. To make sure files were actually included, list all your git settings with git config --list
[user]
email = thomas.anderson@metacortex.com
name = Thomas ANDERSON
[commit]
template = ~/.gitCommitTemplate
[diff]
# Use better, descriptive initials (c, i, w) instead of a/b (source) :
# c : 'Commit' (most often: HEAD)
# i : 'Index' (aka: staging area)
# w : 'Working directory'
mnemonicPrefix = true
colorMoved = blocks
[merge]
conflictStyle = diff3
[alias]
a = add
ap = add --patch
b = branch
co = commit
cane = commit --amend --no-edit
d = diff # highlight differences (at line level) with green/red and +/-
# d = diff --color-words # highlight differences (at word level) with green/red but without +/-
# NB : a 'word' is anything but whitespaces, so '--color-words'
# may show nothing (ignoring whitespaces) while 'git status' list some changed files.
ds = diff --staged
l = ls-files
l1 = log --oneline
lf = log --name-status
lg = log --all --graph --abbrev-commit --decorate --date=iso --format=format:'%C(yellow)%h%C(reset) %C(white)%s%C(reset) %C(blue)%an%C(reset)%C(bold yellow)%d%C(reset) %C(magenta)(%ad)%C(reset)'
# (source)
s = status --untracked-files=no
# show root dir of the current repository
showrootdir = rev-parse --show-toplevel
srd = showrootdir
# count commits (yesterday / today / total) (inspired by)
cc = "!f() { yesterday=$(date --date 'now -1 days' +'%a %b %-d ..:..:.. %Y'); today=$(date +'%a %b %-d ..:..:.. %Y'); nbCommitsYesterday=$(git log | grep -Ec \"$yesterday\"); nbCommitsToday=$(git log | grep -Ec \"$today\"); nbCommitsTotal=$(git rev-list HEAD --count); echo \"yesterday/today/total\n$nbCommitsYesterday/$nbCommitsToday/$nbCommitsTotal\" | column -s '/' -t; }; f"
# squash commits, quicker than 'git rebase -i HEAD~n' (defaults to 'HEAD~2' if number not specified)
squash = "!f() { git rebase -i HEAD~${1:-2}; }; f"
sq = squash
[pull]
rebase = true # turn "git pull" into "git pull --rebase" automatically
# (i.e. "git pull" = "git fetch" + "git merge origin/master")
# This produces a linear history (my commit came after all commits that were pushed before it,
# instead of being developed in parallel). It makes history visualization much simpler and git bisect easier to see and understand.
[color]
branch = auto
diff = auto
status = auto
[color "diff"] # available colors + attributes
new = bold green
old = bold red
newMoved = dim green
oldMoved = dim red
[credential]
helper = cache --timeout=3600