I have a different version of a file in a development branch than I do in the master. The problem is I want to track those files, so how do I merge development into master without overwriting that file?
Asked
Active
Viewed 50 times
2 Answers
0
You can add a merge driver in a .gitattributes
file, with a "keep mine" directive.
That way, any merge will keep the file currently on the destination branch.
See "Accept all merge conflicts in git" as an example of such a driver.
See also "How do I tell git to always select my local version for conflicted merges on a specific file?".
0
You can merge the whole development branch into master by doing:
git checkout master
git branch development
Instead, if you just want to get the changes applied to that file, you can go into the master branch and pick single commits on the development branch through the git cherry-pick command.

Claudio
- 10,614
- 4
- 31
- 71