0

Often, git's auto-merge performs a merge operation in ways I do not want, e.g., removing lines of code that should have been kept while keeping those that needs to be deleted.

So I tried forcing merge by performing git fetch followed by git mergetool, but it does not allow me, and gave me "No files need merging" message.

Is there any way to force manual merge even when there is no merge conflict?

lolski
  • 16,231
  • 7
  • 34
  • 49
  • 1
    Do `git merge` first and then `git mergetool` so you actually have some conflicts to solve. Then you can select which changes you want – Tim Jun 17 '14 at 13:16
  • 1
    you can use `git diff` to validate merge before actually doing a merge – akostadinov Jun 17 '14 at 13:18
  • 1
    @TimCastelijns what I want is to force conflict even on files that could have been successfully auto merged with no merge conflict. Why would I want to do that? Because often it doesn't successfully merges the files in the way I want. – lolski Jun 17 '14 at 13:43
  • @akostadinov is that the common workflow? it feels a bit of a manual work – a lot of copying-and-pasting from the diff output, and back to the associated files. – lolski Jun 17 '14 at 13:44
  • 1
    It's not common that you see wrong merges without conflicts. Sounds like files you're working on are rather specific that don't work well with merge mechanism. So common workflow is just to merge and fix issues if git reports them. Doing a `diff` before merging would allow you to review changes before you actually merge. Where there is something wrong, only then you merge manually. btw you can also try the `patience` and `diff-algorithm=...` options to the `recursive` merge strategy to hopefully help with the issue. – akostadinov Jun 17 '14 at 18:17
  • Seems like I could not reproduce the issue again so I concluded that there must be some kind of human error involved that mislead me into thinking otherwise. Thank you for your help. – lolski Jul 10 '14 at 10:36

1 Answers1

-1

I think I didn't reword it right, but what I wanted was to be able to pull the changes and inspect it before it is actually committed. I found out from manojlds' answer in this thread that the way to go is:

git merge v1.0 --no-commit --no-ff
Community
  • 1
  • 1
lolski
  • 16,231
  • 7
  • 34
  • 49