Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git overwrites files during a merge - does not show conflicts [duplicate]

Possible Duplicate:
Git - how to force merge conflict and manual merge on selected file

We're trying to do a merge between two branches: stable code, and new features.

The merge functionality is not working for us: it sometimes shows conflicts, but often just overwrites files without telling us of any conflict, probably with what it thinks is the right version.

Is it possible to block this overwrite so that it shows us all the conflicting lines? We tried using git diff to get an idea of how extensive it was but there are a couple thousand lines because we had pretty extensive debugging on our stable branch...So we'd really need to get the merge functionality working if at all possible.

So we're in a bit of a messy situation, will greatly appreciate all help.

like image 952
Eric Hiland Avatar asked Dec 20 '12 15:12

Eric Hiland


1 Answers

As I do not know how to reproduce your problem, I need to do some guesswork.

In my experience, confusion surrounding git merge can be usually reduced by doing a git pull --rebase before doing the merge. This pulls in the latest changes from remote, and merges your changes over them. However, do not do this if you intend to merge your changes over an earlier commit. In any case, note down the latest commit ID before doing the pull, so that you can revert to it if there's a problem.

Now coming to the merge itself, you could try using git merge --no-ff --no-commit to prevent the merge from being committed. I do not know if this would give you the full conflict report that you would like to see, but it allow you to examine the merge result (like a simulation mode). If you do not like the result, you could revert the merge using git reset --hard.

like image 150
Masked Man Avatar answered Oct 21 '22 07:10

Masked Man