git merge into master only overwrite changed files
Is it possible to merge branch
edits into branch
master with the following scenario:
many changes were made on
edits as well as new files added.
many changes were also made to
master as well as new files added.
I’d like to overwrite any duplicate files in
master and use the files from
edits, so that when im done,
master will contain all changes from
edits, all new files from
edits and all new files from
master. If both contained new files, it would use
edits‘s new files. If there are merges, I’d like to replace the entire file with the one from
I found this answer: https://stackoverflow.com/a/1295232/1166285 and tried the comment’s suggestion but that made conflicts which i’d have to resolve.
Is this possible?
One Solution collect form web for “git merge into master only overwrite changed files”
master branch, merge in the
edits branch with the
theirs merge strategy:
git checkout master git merge -Xtheirs edits
In case of conflicts, this will prefer the
theirs branch. Changes from
master where there is no conflict will be retained.