One of the things to remember when working as the developer of a project is to have a set of “standards” or “best practices” to follow. This is especially important when you are collaborating as the member of a team within a project. In his article “Best Practices for Version Control,” Anders Sandvig gives seven recommendations for version control best practices. These include:
- Put everything under version control. This means that everything you have that has anything to do with your project should be under version control. Sandvig suggests that version control not only a place to put your code, but can be used to store email correspondence and “concept drawing on napkins” for reference.
- Create Sandbox Home Folders. Sandvig states the giving each developer in a team a home folder in the repository will encourage them to use the version control system. These could serve as experimental folders in which less experienced developers could play around with features of the tool that they would need to use in “real” projects.
- Use a Common Project Structure and Naming Convention. Although this is probably common sense to everyone already, a consistent naming convention is crucial to any project. As Sandvig mentions, this makes it easier to find files when needed.
- Commit Often and in Logical Chunks. How many of us have found this to be the case when working on Flash and Actionscripting? You need to save often, or you risk losing everything that you’ve been working on. Sandvig uses an interesting quote here that is so true: “It’s better to have a broken build in your working repository than a working build on your broken hard drive.”
- Write Meaningful Commit Messages. With this recommendation, Sandvig states that it is important to always make sure that you comment when you commit anything. Although your comment should be brief, it should describe what was changed or updated in this commit. He goes into great detail in this step to suggest several ways in which you can standardize your comments and make them more useful later on.
- Do All File Operations in the Version Control System. Whenever you need to do anything to the files or folders, do it in the version control system. Failure to do so can cause the changes to be lost forever.
- Set Up Change Notifications. To make sure that the other members of your team are aware of what you or others have done, Sandvig suggests setting up email notifications when a commit is made. He argues that it might encourage people into writing more useful commit messages if they know that someone else will be reading them. He also feels that some people could learn something by reading other people’s code.
Overall, Anders Sandvig had some great things for developers to think about when working within a version control system. If you would like to read the full article, you can find it at: http://blog.looplabel.net/2008/07/28/best-practices-for-version-control/.