10 tips for mastering version control systems

-July 16, 2013

Version control systems are a great way to share source code between developers. They provide the ability for multiple people to simultaneously work on the same code base without the danger of sending files back and forth constantly. Make a mistake while developing and rest assured that the simple press of a button can roll back the code to a fresh square one. History has shown that working without a version control system is a disaster waiting to happen! Version control systems are an essential development tool and there are a number of tips for mastering and getting the most out of these systems.

Tip #1 – Commit Frequently
Embedded software at times takes on a life of its own and tends to have a temperamental attitude. A developer makes a few minor changes and the entire system destabilizes into frenzy. The developer has no fear and reverses the few changes he made and voila! The system is still broken. Without a version control system, the developer now scratches their head in panic and tries to understand what change they made that they don’t remember from 5 minutes ago! The engineer using version control on the other hand performs a right click and simply reverts back to the previous working version of the code and now cautiously moves forward. But what if the developer had gone days without committing his code? Days worth of effort could be lost which is why developers using version control should commit frequently! Complete a feature and commit. Get a partial feature working, commit. This will not only save the engineer time when things go wrong but also leave a nice trail in the version control system of the changes that were made.

Tip #2 – Fill in the commit log
It is great if an engineer commits their code changes frequently; however, it can prove to be a futile effort if sufficient information is not provided in the change log. Most version control tools will allow comments to be made at the time code is committed. Fill in the log with helpful and useful information! Don’t leave it blank or put cryptic information here! In the future, a bug may get introduced into the code and as the developer back tracks the versions, it will be essential that the log contain useful information on what changed. It takes only a few moments and will save many hours of frustration and headaches! Try and come up with a common log format that needs to be filled in before each commit.




Tip #3 – Don’t forget to add files to the VCS
Version control systems have been known to play a trick or two on a developer. The biggest is when a developer thinks that he is committing code when he actually isn’t! How can this happen? Most systems require that when you create a file you add it to revision control. If this isn’t done then the system will happily commit and ignore those files that haven’t been added! So don’t forget to add files to the VCS!




Loading comments...

Write a Comment

To comment please Log In

FEATURED RESOURCES