This is usually the case when you need to save (for a given file, here xxx-dev.txt ) various content based on branches, one of the ways:
- version only
xxx-dev.tpl template file - version value files named after branches:
xxx-dev.dev , xxx-dev.master : since they are different, there is no merging problem.
To do this, you must register (in the .gitattributes ad ) in your filter submodule repository . .
(image from Git Settings - Git Attributes , from the " Pro Git book ")
smudge script associated with the template file ( *-dev.txt ) will generate (automatically on git checkout ) the actual xxx-dev.txt file by looking at the values ββin the xxx-dev.<branch> value file. The generated actual xxx-dev.txt remains ignored (using .gitignore ).
See the full example in the git smudge / clean filter section between branches .
Your smudge script can determine the name of the highlighted branch using:
branch=$(git rev-parse --symbolic --abbrev-ref HEAD)
source share