If you’re like me, there’s a great chance that you have not only some public dotfiles but you also have some private stuff you don’t want the world to have open access to. I refer to these private dotfiles simple as dotprivate.
I include my dotprivate files as a submodule within my dotfiles. Where things get tricky is when I want to have a single file that has some public things and some private things.
One such scenario is my
.gitconfig. I have things like colors and editor
settings and such that I don’t mind being shared. Then I have things like my
GitHub email address that I’d prefer to keep private.
git allows you to include files from within your main
.gitconfig file. All you need to do is define an
[include] section and a
path that maps to your separate file. You can even have
[include] path = /path/to/my/other/gitconfig path = /path/to/some/other/gitconfig
Please note that this is only applicable to
git 1.7.10 or above.