Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git merge: keep one side for some files, manual merge the rest

Tags:

git

merge

In a merge with conflicts, is there a way to tell git to keep one version for a set of files?

$ git checkout some_branch
$ git merge origin/master
$ ?
like image 367
Ivan Avatar asked Oct 20 '09 21:10

Ivan


People also ask

What happens if you get a conflict during a merge?

Merge conflicts happen when you merge branches that have competing commits, and Git needs your help to decide which changes to incorporate in the final merge. Git can often resolve differences between branches and merge them automatically.


1 Answers

If you've already attempted the merge and are looking at the unmerged files, you can use git checkout:

git checkout some_branch git merge origin/master <conflicts!> git checkout --theirs -- <dir>|<file> 

(and of course, --ours keeps the version from the current branch)

like image 183
Cascabel Avatar answered Oct 11 '22 02:10

Cascabel