Locking binary files using git version control system

Subversion has locks, and they aren’t just advisory. They can be enforced using the svn:needs-lock attribute (but can also be deliberately broken if necessary). It’s the right solution for managing non-mergeable files. The company I work for stores just about everything in Subversion, and uses svn:needs-lock for all non-mergeable files.

I disagree with “locks are just a communication method”. They are a much more effective method than push-notifications such as phone or e-mail. Subversion locks are self-documenting (who has the lock). On the other hand, if you have to communicate by other traditional push-notification channels, such as e-mail, who do you send the notification to? You don’t know in advance who might want to edit the file, especially on open-source projects, unless you have a complete list of your entire development team. So those traditional communication methods aren’t nearly as effective.

A central lock server, while against the principles of DVCS, is the only feasible method for non-mergeable files. As long as DVCS don’t have a central lock feature, I think it will keep the company I work for using Subversion.

The better solution would be to make a merge tool for all your binary file formats, but that’s a longer-term and ongoing goal that will never be “finished”.

Here’s an interesting read on the topic.

Leave a Comment