0

When running git merge with theirs:

$git merge --strategy-option theirs

It is not helping to merge the files:

error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

So can that command help me here? Do I need to merge all of the (many..) files manually?

I did look at Git merge strategy 'theirs' is not resolving modify/delete conflict and afaict none of the answers provided a way to do this.

Update I bit the bullet and ran the bfg tool on my active directory since I could not get the merging/resolving to work in a clone. This seems to be moving ahead: here is the IJ enter image description here

WestCoastProjects
  • 58,982
  • 91
  • 316
  • 560
  • So you first just said merge and then when it stopped with a conflict you tried to say `git merge --strategy-option theirs`, is that really what’s going on? – matt Jul 21 '19 at 02:03
  • I had been using `bfg` to remove large files and apparently it starts a `merge` ..? - so then I guess the answer to that is indirectly yes. – WestCoastProjects Jul 21 '19 at 02:05
  • Yes, I don't know the bfg but you can't do a merge in the middle of a merge. – matt Jul 21 '19 at 02:33

1 Answers1

1

This error message:

error: Merging is not possible because you have unmerged files

means you have already started a merge. You cannot start another merge until you finish, or terminate, the current one. That's all there really is to it. Think back to when you started some earlier merge, that you have not yet finished. Is that merge important? Should you finish it now? If so, finish it now before you start another.

Your other option is to use:

git merge --abort

to tell Git: "Oh, hey, remember that other merge I started yesterday / last week / last year / whenever it was? The one I haven't finished yet? Stop it and get it out of the way now and go back to the way everything was last week or last year or whenever it was."

Caution: stopping and going back to the way things were last year could lose any unsaved changes.

torek
  • 448,244
  • 59
  • 642
  • 775
  • makes sense - thx.Looking now into completing the prior merge. How do I bring up / edit the conflicts? Invoking `git merge` clearly does not work ;) – WestCoastProjects Jul 21 '19 at 02:03
  • `git status` should tell you most of what's going on, unless your Git is very ancient (CentOS comes with Git 1.7 or 1.8 which are very ancient). Some people swear by `git mergetool` (along with one of vimdiff, or k-something-or-other, or some third party merge tool) for completing conflicted merges, but I tend to swear *at* it instead. :-) I prefer to set `merge.conflictStyle` to `diff3`, which puts more information into each conflicted work-tree file, and then `git status` tells me which work-tree files are still unmerged. – torek Jul 21 '19 at 02:16
  • From there, I just fire up my editor (I use vim these days; there was a time, pre-Git, when I used Emacs, back in the 1980s) on the conflicted files. Note that if you have a conflicted file you edited partly, but then want to give up on and restore to conflict state, you can use `git checkout -m` to do that. This is especially useful if you change your `merge.conflictStyle` setting, since the re-created conflict work-tree file uses the new style (or the selected one with `git checkout`). – torek Jul 21 '19 at 02:18
  • Thx. I applied the `bfg-tool` to my active directory. It's risky but I can't get the clone'd one to play with IJ. I am updating the OP with screenshot of using IJ that is now helping. – WestCoastProjects Jul 21 '19 at 02:20