Sharing the git config across different computers with individual modifications
As I am working on a lot of different computer I wanted to share some of my configuration files across these computers to have similar working environments on all of the machines. An easy solution to do this is e.g. for git to put the
.gitconfig file (along with other configuration files) into a folder inside the Dropbox (or other syncing tool), create a symlink to that file in the original location in your home directory and let Dropbox do the syncing.
However, what if some parts of the git config are device specific? E.g. the visual difftool on my Mac is different from the one on Linux workstation, also the keychain helper. The solution I came up with is to let the shared
.gitconfig include a device-specific file for the specific settings using the include feature available since 1.7.10:
1 2 [include] path = .gitlocal
Now I can configure device specific settings in the
~/.gitlocal file which is not synced by Dropbox.
Unfortunately, some of the computers I am working with have older git version running not supporting the include feature. For these machines I can at least include all settings shared between them in the usual
.gitconfig file and override them for other computers in their
.gitlocal files. Not perfect, but it works for my setup.