Computer Laboratory

Committing (sending) changes

For more details on using Subversion visit the Subversion online instruction book


The svn commit command sends all your changes to the repository.
When you commit a change, you need to supply a log message describing the changes, which will be attached to the new revision created.
It is useful for other authors, to be clear in your log message about the changes you have made, so they don't have to waste time examining the changes you have made.

Short log messages

For a short message you can use the -m switch.
The following example shows the log message for webpage www.cl.cam.ac.uk/supporters-club/members.html which underwent various edit check revisions.
The log message contains information about each set of changes made to the file, which the original or next author may find of use:

	$svn commit -m "Made bullet and contact details consistent in style. Hyperlinked web
	addresses. Swapped Xilinx and XenSource bullets round so they were alphabetical.
	Changed pound signs to £" members-b.html
	Sending members-b.html
	Transmitting file data
	Committed revision 212
Note:
The actual log message, in this example, is in bold for illustration purposes only, to differentiate between the main svn command, and the log note itself.

Long log messages

If your log message is very long, you can create it as a file, and then pass it within the svn commit command:

	$svn commit -F logmsg members-b.html
	Sending members-b.html
	Transmitting file data
	Committed revision 213

Forgetting to add a log message

Should you fail to specify either -m or -f switches, Subversion will automatically launch a text editor to allow you to compose the message.

	$svn commit
	Waiting for Emacs...Done
	Log message unchanged or not specified
	a)bort, c)ontinue, e)dit
	a
	$

In the example above, the request to create a message was aborted, so no commit occured, and no editing.
Had the e)dit command been chosen, Emacs would have opened to allow the user to create the message.

Committing a changed file

If someone has changed the file and comitted it before you commit your file, Subversion will tell you:

	$svn commit -m "added another member to the list" members-b.html
	Sending members-b.html
	svn: Commit failed (details below)
	svn: Your file or directory 'members-b.html' is probably out-of-date

Run svn update, deal with any merges or conflicts that may have occured and then attempt to commit again.