Version Control — Best Practices for Developers

We all developers know some basic knowledge of version control. In outline, the version control saves versions of code which can then be reused, or in case of issues, applications can be reverted to older working versions. Popular version control solutions used today are Git, Subversion (SVN), Perforce and others. Version Control is vital at the enterprise software development level where you have a vast number of disparate teams. It is an every-day part of the developer’s routine, but also helps organizations achieve some high-level business goals such as increasing efficiency and improving quality and reliability of software.

Today I want to share some best practices for developers related to version control. You’d be surprised how many folks I’ve seen struggle to follow these guidelines. These tips benefit the developers by cutting down redundant work, increasing efficiency, and helping to prevent mistakes and errors. Following these tips will also promote teamwork and better collaboration as all of these habits make it easier for different people to work on the same code.

Best Practices for Version Control Users

  1. Make small changes. In other words, commit early and commit often. Of course, be careful not to commit any unfinished work that could break the build.
  2. Don’t commit personal files. These could include application settings files,.inf files, build files,.gradle files,local.properties files etc.,. Often these are committed accidently but cause problems later down the line when other team members are working on the same code.
  3. Update(Pull) often and right before pushing to avoid merge conflicts.
  4. Verify your code change before pushing it to a repository; ensure it compiles and tests are passing.
  5. Pay close attention to commit messages as these will tell you why a change was made. Consider commit messages as a mini form of documentation for the change.
  6. Link code changes to work items. This will concretely link what was created to to why it was created or changed by providing traceability across requirements and code changes. (refer below dotted points).
  • If you edited or fixed a bug means you need to provide the message like “Bill discount change — Bug Fix 1”.
  • Again if there is any change means the message like “Bill discount change — Bug Fix 2” , additional requirement means “Bill discount change — additional requirement Fix 2”.
  1. No matter your background or preferences, be a team player and follow agreed conventions and workflows. Consistency is important and helps ensure quality making it easier for team members to pick up where you left off, to review your code, to debug, etc
  • For Example, If you commit your work for the first time, the message like “Bill discount change”.
  • If you edited or fixed a bug means you need to provide the message like “Bill discount change — Bug Fix 1”.
  • Again if there is any change means the message like “Bill discount change — Bug Fix 2” , additional requirement means “Bill discount change — additional requirement Fix 2”.

Using version control of some kind is a must for any organization and following the guidelines above can help developers avoid needless time spent fixing errors and mistakes. These practices also help organizations reap greater benefits from having a good version control system.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
sathish kumar

I am a boy of Passion. Passion for my God, passion for worship, passion for India, passion to see people fulfill their destinies, passion to change the world.