How to force Comments on SVN Commit

Tagged Under :

If you are using Subversion, you might have come across this issue. Multiple developers working on a set of files and committing them without any comments. If you decide to force comments on every commit, here is a little pre-commit hook script that will do the job. Just to be clear, a pre-commit script is fired when the user hits the ‘OK’ button on the commit dialog box.

This script would need to be under /{repository-location}/hooks/. There are some template scripts already in there and this one is probably a slight modification of one of those samples in there.

Here it is.

Comments:

8 Responses to “How to force Comments on SVN Commit”


  1. Thanks for the post, Anuj! This is exactly what I needed, when I needed it. Fate….


  2. Good to know that Marc. It takes time to get used to comment before commit but definitely useful in the long run or when you are looking at commit stats etc..


  3. Great one!
    This is very usefull, thanks.


  4. thx. that’s really useful!


  5. Here come the single dot “.” commit messages.

    In my opinion, nice, but not at all effective I’m afraid.


  6. @Jeroen, I agree to that. Rules are always broken and always will be. But that doesnt mean you dont apply rules. Its just one of those things.

    On a second thought, you could probably actually check the comment length and force atleast 5 or 10 characters. Havent tried but probably possible.


  7. Works a charm - thanks for this.


  8. Might want to mention that this is for windows only. I started to copy and paste it and place it into my hooks directory, then noticed the echo, rem, etc. statements.

Leave a Reply