Git merge on windows conflict occurs and the line in the file is not marked

0

When trying to perform a git merge on Windows in a file that has been modified on the same line, the message:

warning: Cannot merge binary files: g.txt (HEAD vs. feature3)
Auto-merging g.txt
CONFLICT (content): Merge conflict in g.txt
Automatic merge failed; fix conflicts and then commit the result.

But when you open the file where the warning occurs, it is not marked with "

asked by anonymous 23.04.2017 / 00:00

1 answer

0

Although Linux understands that it is a text file, it does not mean that Git will understand it in the same way.

The cause of this error is several:

  • The repository file has different encoding than the changed file.
  • The file has some features that make Git think it's a binary file. This may be connected with the encoding used or even with file content. Long lines of text may cause Git to interpret the file as binary.

To resolve, you can add a hidden file named .gitattributes to your repository:

<projeto>/.gitattributes

Inside it, add:

g.txt diff

This will cause Git to treat the file as a text file. Please edit this file to share the solution with the other users of the repository.

    
25.07.2018 / 19:35