Posted on Leave a comment

What is Version Control?

What is Version Control

Imagine 100 people working on a single project and each of them need to submit their code once or twice a day for 3 months, keeping track of it would be chaotic right? Yeah for sure, that’s there’s a walk around that, called Version Control.

Version Control is a system that keeps track of changes to a file or group of files over a period of time. There are some popular version control systems out there such as Git, Bitbucket, Github.

Some Common Terminologies:

1) Working Copy:

Sometimes called Checkout, is your personal copy of all the files in your project. You make copies of all your changes to that copy only you can edit.

2) Repository:

A database that stores all your changes, edits of your project. There are times when some the repository may have some changes that are not found in the working copy.

3) Commit:

When a user saves his instance of his working copy into his repository.

3) Push:

When a user submits his version of his local repository unto the main Central Repository.

4) Pull:

When a user gets all the saved version of the central repository unto his/her own repository.

5) Branch:

A Separate file/folder meant for private use or even research.

6) Merge:

Applying changes from one file/folder to another. users usually merge features from one branch to another.


Different Types of Version Control Systems:

1) Centralized Version Control:

Each user gets his own working copy, but there is one Central Repository. Example Subversion, Perforce.

Centralized Version Control

Figure Showing A Centralized Version Control Credits:

2) Decentralized or Distributed Version Control:

Here there are many copies of the repository available. Here the working copies are mirrored from the main Server, clients don’t have to check often as is in the case of a Centralized Version. So if the server goes down, each user has the same backup code as-is on the Server. Each user gets his/her own of the repository and a working copy, when you commit changes aren’t reflected on the main repository. Others can’t view what you did until you push your changes to the central repository.

Examples of Distributed Version Control systems include Git, Bitbucket.

Distributed Version Control System

Figure Showing A Decentralized Version Control Credits:

Some issues that may arise using Version Control Systems:

  • Two users may simultaneously push to the same line of code in the central repository at the same time. This is issue falls under conflicts.

Some best practices:

  • Always label your commits with descriptive messages, this saves time and efforts from other members of the team to keep track of what’s happening.
  • Avoid indiscriminate commits, don’t just do a batch commit of all the files in your workcopy.
  • Coordinate with other coworkers, keep them updated on all the latest changes and happenings in your code.
  • In a distributed Version Control system always do the following:
    • Make a git pull request
    • commit changes to your repository and make sure everything works correctly.
    • git pull again
    • Then push to  Local Central Repository

If you need professional help in Web Development, Digital Marketing and IT Consultancy, feel free to Contact Us.

Leave a Reply

Your email address will not be published. Required fields are marked *