Some time ago I created a branch from my master
branch. Let's call it new_feature
. While I was working on new_feature
, the master
branch followed its normal evolution. Now that new_feature
is ready to be merged into master
I see some conflicts, all of them are into files that are totally unrelated to the actual new feature (like some config files and the likes that have changed on master
). I'm going to solve the conflicts manually but I was wondering, since it's a situation that happens quite often, how I could just merge the new_feature
branch into master
while always keeping the master
version of the files in case of conflict?
I'm sure it's easy and is related to something like 'keep version' but since it's a pretty sensitive subject I'd rather ask than be sorry.
As mention in the comment there are several strategies in the documentation. You can also find them here: http://git-scm.com/docs/git-merge
You are looking for either git merge -s recursive -X ours
or git merge -s recursive -X theirs
depending on the branch that you are on. Be careful with these as you can accidentally miss changes to your files from the other branch and these would be overwritten.
Another method, which I prefer due to more control, is to git checkout <other-branch> -- <list of files>
. This way I don't accidentally overwrite a file with the wrong changes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With