I’m using Syncthing to synchronize several developer machines. In these cases, it’s often useful to ignore auto-generated files.
I already have lists of such files in the form of .gitignore files. However, these are not interpreted by Syncthing. This is why I created a script to update my .stignore based on the .gitignore files it finds. I’m posting the script here in the hope that it will be useful to others.
The script (sorry, new users cannot upload files…)
On that note, a question: would it be useful to have the two tools use the same format? I know it’s an incompatible change… but it feels wrong to me to have two slightly different mechanisms and file formats for essentially the same thing.
When a line contains a trailing slash, git ignores the slash but matches only directories. Syncthing does not support this. A line with a trailing slash will sync the folder but ignore all files inside.
Syncthing uses the first matching line to make a decision. On the other hand, git will include a file if a negated line comes after a matching line.
How ** is handled is slightly different. Git is fairly strict regarding what places ** can occur; foo**bar is accepted by Syncthing but not by git.
EDIT: also, foo/**/bar matches foo/bar in git, but not in Syncthing, it seems.
Paths in git are relative to the .gitignore file. It is possible (and often useful) to have .gitignore files specific to a subdirectory.
More of a philosophy difference: .gitignore files are version controlled, but .stignore files are not synced. Git has a different mechanism for unshared ignores (~/.gitignore and .git/info/exclude).