Learn About Version Control Best Practices

Learn About Version Control Best Practices


How many version control best practices do you know of? Version control helps many users work together on the same project. Create file copies and share them with the crew later or edit the same file. In case you lose the current edits, you have historical versions to avoid rework. However, conflicts happen when two users are editing the same line. To prevent such incidents, you need some protocols. In this article at Washington.edu, Michael Ernst shares version control best practices.

Version Control Best Practices

To use version control effectively, you need a repository or database to save changes. A ‘working copy’ or ‘checkout’ is a file that you can work on individually without affecting your teammate’s efforts.

Organizations generally use two types of version control: distributed (Git, Mercurial) and centralized (Subversion). A centralized control uses one repository while the distributed counterpart avails several.


  • Create a commit message that is comprehensive for anyone to understand the reason behind the change.
  • Every commit should have only one purpose to help the next user locate feature or bug issues faster.
  • Mention file names if you are running git commit -a to avoid commands that would commit every changed file randomly.
  • Always work with the latest version. So, run git pull, git pull -r, hg fetch, or svn update as often as possible.
  • Once you have made the commit, inform your teammates with git push or hg push.
  • If multiple users want to work on the same line of the file, one of the version control best practices is to convey your intention to avoid conflict or rework.
  • VC tools store changes one line after another in marked-up text but not WYSIWYG text.
  • Avoid committing binary files ending with .o and .class or .pdf. Commit only the source files.
  • Get the hang of your merge tool so that you do feel stressed to meet a deadline.
  • Work on your own working copy like git clone URL, hg clone URL, and svn checkout URL.

More Tips

Distributed version control best practices might be a bit different. Use hg fetch instead of hg pull for Mercurial control. If Git or Mercurial does not want to accept the action, never use -force: or -f. Also, keep in mind that you must commit and merge before updating. Otherwise, it would throw errors: ‘abort: outstanding uncommitted changes.’ Since SVN (Subversion) automatically cashes your password, you just have to insert the password once. Turn on email alerts for any push or commit to the central server changes.

To view the original article in full, click on the following link: https://homes.cs.washington.edu/~mernst/advice/version-control.html

The post Learn About Version Control Best Practices appeared first on AITS CAI’s Accelerating IT Success.

Leave a Comment