GIT conflict markers in .meta files (usually guid conflicts) [SourceTree]

For anyone having strange conflict markers like this in .meta files:

fileFormatVersion: 2
<<<<<<<< HEAD:Assets/Textures/Snowball.png.meta
guid: ad67fb66c24feff4c8891edb0518744e
========
guid: 18ad9c11f0edc1c46b797eb727f1040d
>>>>>>>> main:Assets/Textures/IceCannon.png.meta

The reason is GIT having conflicts between files it thinks have been renamed, then not showing message about the conflicts.

The solution is to disable renaming in git: click top right button “Teminal” in Source Tree, and run commands:

git config diff.renames false
git config merge.renames false

I added second command git config merge.renames false, because the first one alone didn’t fix the errors.

I also removed “SOLVED” from the title, as I can’t be completely sure if the errors are now solved either (it takes 1-2 weeks to reproduce the error).

Interesting.

If I understand correctly GIT is performing some form of hashing on files to detect cases when a file has been moved or renamed so it can avoid the overhead of deleting/creating new files in the database. In this case though that hash must have caused a collision between ‘Snowball.png.meta’ and ‘IceCannon.png.meta’.

If that is the case then perhaps a better strategy is to simply find a way to change the contents of the meta file to force a new hash? Obviously its difficult to change things like the GUID, but there are other means to alter the content. One might be to write to the userData property, but i’m not sure how to accomplish that.

The most straightforward method I can think of would be to add a dummy Label to the asset. That changes the content of the meta file, but shouldn’t impact the editor in any significant way. Perhaps even a single character label would suffice.

Having said that I feel like this must be quite a common occurrence in large projects in GIT. So much so that there must be a better solution than simply disabling the rename feature?