I have two branches: one for development and another for production, each one has its own config values in app.config file
what I want is to ignore these values whenever I merge or rebase these branches.
Then perhaps you best bet would be to not even version the app.config
Exactly, but you can still generate it, with a content filter driver, using .gitattributes
declaration.
What you would version is a template file, and a file with all possible values per environment (per branch).
(image from "Customizing Git - Git Attributes", from "Pro Git book")
The generated actual file remains ignored (by the .gitignore
): your actual working tree does not get "dirty".
The smudge
script:
smudge
script is applied on during a git checkout
.That way, you modify the config.<branch>
value file as much as you want: the config file (not versioned) will be generated from those values.
And it won't have any merge issue.