I have a couple of files (a pom.xml and an appengine-web.xml (GAE config file)) that I want to keep in different states in different branches of the same project.
Similar questions have been asked before and two of the solutions I've seen suggested before are:
git merge --no-commit from-branch
, and,- Create file
.gitattributes
in the same dir, with this line:filename.ext merge=ours
(paraphrasing)
Both these only protect the file in the current branch from merges if there is a conflict during merge. In case of an FF merge, the version in the current branch gets overwritten. I want these files to not be overwritten even in the case of an FF merge.
Isn't there a way to protect the version in the current branch from ever being overwritten by a merge, unless invoked by a file-specific command?
I am currently resorting to not checking in the per-branch files, putting them on the stash and then restoring from there when I come back to the branch. Is there a more efficient and less fault-prone way?