Maybe it might be a strange need, but I believe it would be helpful to have something like this:
if($branch$ === \"master) {
// Special code for the maste
Git has not keyword expansion but Git has filters:
You would set up a smudge filter that gets run every time you checkout the file to your working copy. In this filter, you can check the current branch and do some magic stuff in your sources (original images taken from (outdated) http://git-scm.com/book/ch7-2.html, now http://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#Keyword-Expansion):

You would also set up a clean filter that gets run every time the file is staged:

Of course, you would set up the filter not for ALL files you're using but only for a single one that gets included by the other files of your project.
This would be the Git way to do what you want.