Irrespective of the technologies used like .Net,Java or PHP software versioning plays a critical role in software development. In this blog we will go through a set of best practices for successful implementation of version control in an organization.
1) A single commit in repository should be done for a specific task like below:
a) Bug Fix
b) Existing feature improvement
c) New feature addition
We should try not to check-in changes for multiple tasks simultaneously.
2) Developers should never commit incomplete work in the repository as it will lead to compilation error or even application crashes.
3) Developers should try to work on the latest code base in repository and should also commit there work for a completed task as soon as possible. This will minimize conflicts within team because all team members will have latest changes.
4) Appropriate comments should be added at the time code is checked in so that other developers can understand the code changes and also it will help the developer in recalling details of the task if he needs to modify the code again after several months.
5) In case the changes has database dependencies , these also should be commented and the rest of the team members should also be informed.
6) We should do branching if required for better isolation and traceability as below:
a) Feature Branch: A branch used for working on a new feature
b) Fixes Branch: This branch is used for fixes for latest release even as development team continues to work on main trunk.
c) Maintenance Branch: This branch is used to maintain an old build.
7) We should always tag before making a release and also in case we are making major changes in the code base.
8) To ensure directory structure is consistent we should adopt the following standard approach. We use a “project root" as the base point for a project and this project root further contains three subdirectories: (root)/trunk, (root)/branches and (root)/tags.
9) All modifications in the code base should be done using the commands exposed by version control system. This will ensure a proper audit trail for the changes.
10) Whenever there is a change in repository due to checkins, notifications should be sent to all users so that all the team working on the project is in sync.
11) We should never intermix the usage of tags and branch. They are meant for specific usage as below:
Tag : This represents a version of a specific branch at a moment in time.
Branch : This represents a thread of development that runs in parallel with other development efforts on the same code base.
12) Version control software provide "ignore" functionalities which can be used to ignore system generated files (e.g. user settings, IDE generated files etc). These files need not be checked in the repository.
13) We should use different code branches for testing and development. This ensures development is not being done on a branch which is currently being tested.
14) It is a good practice to use continuous integration along with version control. Automated builds ensure that problems are caught early in the system.
15) Following are some of the major version control software in use :