Splitting .gitconfig based on project
I keep my personal projects separate from my work-related projects in git. This requires remembering what I'm currently working on and applying that profile to the commits, git_template, etc. I recently learned about a new git configuration feature called conditional includes . It allows one to split out project/folder/branch-specific git configuration into its own .gitconfig fragment. This allowed me to get rid of bash functions that setup my git configuration (e.g. GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL) depending on what I was working on. So I ended up with the following ~/.gitconfig : [user] name = Amit Kucheria [includeIf "gitdir:~/work/sources/"] path = ~/.gitconfig-linaro [includeIf "gitdir:~/work/sources/personal/"] path = ~/.gitconfig-personal My ~/.gitconfig-linaro looks like this: [user] email = "amit.kucheria@work.com" My ~/.gitconfig-personal looks like this: [user] email = "amit.kucheria@personal.c