Apache Subversion’s ‘SVN Commit’ command sends changes from your working copy to the central repository, and is an essential command for sharing changes with the rest of your team. In this post we’ll show you how to perform an ‘SVN Commit’ before moving onto some best practices to bear in mind when committing your changes.
1) To perform a commit, you must first open the terminal window. To open this in Windows, press the “Windows key” and “r.” This will open a ‘Run’ dialog box.
2) Enter ‘cmd’ and click ‘OK.’
3) The terminal window will open. This is where you’ll enter all your SVN commands.
4) A commit is performed using the ‘SVN Commit’ command, the location of your working copy, and an appropriate log message. So, if your working copy has a location of C:\Users\Jessica\Documents\New_Project, the command would be:
5) Hit ‘Enter’ and your changes will be committed to the repository.
SVN Commit: 5 Best Practices
- Always perform an ‘SVN Update’ before committing changes – this will help to avoid conflicts, and allows you to check how your changes perform in the latest version of the project.
- Don’t commit unrelated changes – (i.e two bug fixes in one commit) this will make it difficult to distinguish where changes originated from and it can cause major headaches if the team decides to roll back to a particular revision.
- Commit little and often – commit small changes frequently, instead of committing many small changes bundled into one large chunk. This will reduce the chances of encountering complications such as merge conflicts, and will reduce the complexity of conflicts when they do occur.
- Never commit half-completed code – this will make rolling back to a previous revision tricky. This may seem to go against the concept of ‘commit little and often,’ but the solution is to split the task you’re working on into manageable but logical pieces, and then commit these regularly.
- Make use of log messages – it is good practice to enter as much information as possible in the log message, as this can be an invaluable source of information if you need to revisit this particular revision at a later date. When performing a commit, the log message is entered in the “–message” format (e.g “–added ReadMe file”)
Need more info?
On June 7th we’ll be holding a free ‘All About the Subversion Commit Command’ webinar. This one hour webinar will cover:
- Commit dialog options
- Files or folders
- Unversioned files
- Ignored files
- Drag and drop
- Common problems and how to avoid them
‘All About the Subversion Commit Command’ is free to attend but places are limited, so register now to avoid disappointment.