SVN Comment Editor

Comments are essential to Subversion checkins. A good text editor is essential to a good comment. Here's how to set the editor of your choice to pop up when you do an svn checkin.

Comments are essential to Subversion checkins. A good text editor is essential to a good comment. Here's how to set the editor of your choice to pop up when you do an svn checkin.

Of course, the best plain text editor (and so much more) that I can think of is Emacs, so we'll use that for this example.

SVN will attempt these options in this order when trying to launch a text editor for checkin comments:

1.Command-line option --editor-cmd2.Environment variable SVN_EDITOR3.Configuration option editor-cmd4.Environment variable VISUAL5.Environment variable EDITOR6. Possibly, a default value built in to Subversion (not present in the official builds)

I prefer option #2:

emacs ~/.bashrc

# add this line
export SVN_EDITOR="/usr/bin/emacs"

Reload your bashrc:

. ~/.bashrc

And now do your checkin:

svn ci information.html

And voila, Emacs pops up in all its glory!

For short comments, the inline option might be more convenient:

svn ci information.html -m "This is my comment"

For the section of the Subversion manual describing this, see this page.