Subversion: prevent local modifications to one file from being committed?

There have been a few answers that can work:

  1. Create a pre-commit hook script that reject the commit when a specific property is being added. You can then add this property to files in the working copy to prevent commits.
  2. TortoiseSVN will exclude files in the special changelist “ignore-on-commit”. However, this is not honored by the SVN command-line client.

CoverosGene suggested that the default commands such as svn commit operate on a default changelist, such that you can exclude a file if you assign it to another changelist, but I can’t find any reference of that in the documentation, and in my testing this does not work.

Since there is no good solution for the SVN command-line client, I’ve opened an enhancement request here. The request suggests that the command-line client could also honor the “ignore-on-commit” changelist.

Update: This is now issue 2858 and there is a feature outline to handle it with an svn:hold property.

Leave a Comment