Search code examples
gitmerge-conflict-resolutiongit-merge-conflict

How can I mark a file conflicted


I've been working on a project with another developer and he recently committed and pushed a file that was conflicted and unresolved.

Furthermore, he merged this file to our main branch. Today I, after numerous commits, pushes, and merges, noticed when I was trying to take a build.

I used soft reset to get back to its branch but I cannot get the file to be marked as conflicted.

Is there any way?

Note: Mind that this file is something like docx, which can only be opened and edited in a specific editor. I cannot open it in Notepad++ and manually resolve the conflict and commit back.


Solution

  • You can create a conflicted state by re-attempting the merge he originally performed. Check out (via git checkout, not git reset!) one parent of the merge commit, and then git merge --no-commit the other parent. This will merge all the files between the two, but you only care about one so you can ignore the rest. Resolve the conflict using whatever tool you need, and you will have a fixed version of the file. Put it somewhere safe, then go back to the current master branch (or whatever) and commit the changed file.