0

In my branch, I add a new folder with some files in it mine_only/**, and I modified some other files.

In their branch, they also modified some files, when I merge their branch, some files are merged, and some files have conflicts.

I need to keep mine_only/*** but discard my other changes to above other files and use theirs only.

I find if I use -X theirs, only the conflicted files are theirs, my changes to those unconflicted files still remains.

How can I do that?

gacopu
  • 594
  • 3
  • 21
  • Can you make your question more clear? – Vy Do Dec 18 '18 at 00:48
  • Possible duplicate of [(Git Merging) When to use 'ours' strategy, 'ours' option and 'theirs' option?](https://stackoverflow.com/questions/45402742/git-merging-when-to-use-ours-strategy-ours-option-and-theirs-option) – phd Dec 18 '18 at 13:35
  • In short, you need `git merge -s ours`. – phd Dec 18 '18 at 13:35

1 Answers1

0

you can checkout their branch version with

git checkout their-branch -- .

then you can checkout your changes into the working folder

git checkout your-branch -- my_folder/.

now just add all changes and commit to finish your merge.

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141