Resolving sync conflicts in git folder.

How should I deal with the following files. I’ve already stopped syncthing, I won’t be using it in the forseable future for anything other than one-way sync from my phone camera to my desktop (usb cable replacement).

This is from a git repo that I work on between my desktop and laptop and then push to the server when the time is right. But somehow I keep ending up with these conflict files, and I don’t know enough about git’s underlying file structure to make an informed decision on what I should keep.

$ find ./ -name '*.sync-conflict-*'

How can i determine whether I should keep the conflict file or the existing file? Is there info somewhere on when they were last edited, and (possibly more importantly) which computer each was created from? The files i’ve tried to inspect are not human readable, so i’ll have to rely on other information to make an informed decision.

As a final note, this worked for a while, but changing computers, updating software, etc has left me in this mess, so be careful if you’re going to try syncing files that don’t have an obvious way to manually discern the differences to make an informed decision when conflicts arise.

Syncing git repos is a terrible idea for this exact reason. I would nuke the repo and clone from source.


Could you please explain why exactly “syncing git repos is a terrible idea”? Git repo is a folder with files as any other folder. Of course I have to be sure full synchronization is finished before working with repo at another computer. In such case I do not see reason why it should terrible idea.

It’s a terrible idea because as opposed to for example a folder with five Word documents in it, the files are not independent. If you have two sides making concurrent changes Syncthing will “merge” the two and the result is not something that is consistent in the Git world. The result is a corrupt repository.

Use Git as Git is intended: using fetch and push.

You might think that you can make sure only one side makes changes at a time. You are replying to a thread where that didn’t happen. If you got here by any search related to Syncthing resolving sync conflicts in a git folder, you are doing it wrong.

Do not use Syncthing to sync Git repositories.


Do not.


Thank you for reply. I got here when I was evaluating if syncthing is useful for me or not. I was looking for stability, errors etc. before testing it.

The only reason I asked was that this sentence: “Syncing git repos is a terrible idea” is to general and I feared there is some issue. It should have been written in this way: “Syncing git repos is a terrible idea if you have concurrent changes”

World is complicated, there are other applications that have complicated file/directory structures, not only git. And there are documents suitable for versioning, but pushing them somewhere is not needed etc. It would be too complicated to separate directories according if it is or is not git repository.

Separation isn’t needed, you can just ignore .git directories.

Not only git rely on specific structure and composition of files.

Still, this would not solve anything. E.g. I want to sync my whole working directory with many projects and documents to another computer and leave for a travel. I want to take the .git directories with me. The other possibility, to do git push and git pull for every git repository would be too complicated.

This is not a Syncthing limitation, it’s a property of Git repositories. You should use Git as Git is intended.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.