Version Controlling

Mishan Kavindu Perera
6 min readMar 17, 2022


Version control is the process of keeping track of changes to a source. A relevant revision number uses to identify the modifications. Each modification includes a timestamp and the identity of the person who made the change. It is possible to restore, compare, and merge revisions. Developers utilize version control because it allows for more accessible backups and a central source code repository. It is also a simple collaborative development. When new developers join the team, they can use the version control system to easily download the latest version of the program to their local environment and keep track of the version they are running. It also manages access.

1. Terminology of version controlling

a. Commit

Make a copy of the modifications to the files. Every time they are committed, it effectively takes a snapshot of all the files at the time and saves a reference to that snapshot.

b. Repository

A repository is a directory that includes the project’s work and all files used to communicate. Repositories can exist locally on the computer or as a remote copy on another machine.

c. Branch

Developers can use branches to generate different versions of their projects. They can work on new features and experiment with new ideas without affecting the original project when they branch.

d. Trunk

The unnamed branch of a file tree under revision control is the trunk. The trunk is typically intended to serve as the foundation for a project’s development.

e. Merge

A merge, also known as integration, is a process in which two sets of modifications are applied to a single file or a group of files.

f. Conflict

When many parties make modifications to the same document and the system cannot reconcile the changes, a conflict ensues. A user must choose between combining the modifications or selecting one change over the other to settle the conflict.

g. Checkout

A checkout is used to make a functional copy. Checkout takes a server revision and creates a local working copy with the information needed to link it to the server’s repository. It is possible to amend a checkout and then apply the changes to a repository.

2. Best practices

Commit changes automatically. Whether the team is big or small, every team should follow the best practices of version control. These include:

a. Commit changes automatically

In version control, one recommended practice is to commit changes atomically. A commit’s files are either committed all at once or not. No other user should be able to see changes that are only partially completed. To keep the project consistent, commit all files that relate to a task in a single process. When it comes to pledges, it’s critical to follow best practices. High-quality commits will help you increase your project’s productivity and success.

b. Compose effective commit messages

Writing good commit messages is another best practice. Each commit should have a description that indicates why the change was made, but not necessarily how it was made. (It is usually possible to figure out how by comparing the contents of the files before and after the change.)

c. Commit files for a specific purpose

Each commit should be the focus on a particular goal. Fixing a problem or creating a new feature, for example. Evaluating and reviewing the project can be challenging if a single change causes several independent changes. The procedure of undoing one of these changes becomes more difficult and time-consuming.

d. Builds should not be broken

Another excellent practice in version control is to avoid breaking builds by making complete commits. Provide test cases and stubs for new APIs. It ensures that other team members can use each commit without destroying their build. It is easier to propagate a complete commit between branches. For example, an incomplete API change might build locally in the work area and pass all tests. However, it may cause damage to another team member’s workspace.

e. Before committing to a shared repository, do reviews

Doing reviews before committing to a shared repository is also a best practice for version control. It is frequently inspected before merging an excellent commit to a shared repository. It can be accomplished using either a review system or a pull request. Reviews are an excellent approach for gaining a different perspective on a modification and improving the code’s quality. Code reviews can also help the team become more aware of the code. It improves the team’s productivity by allowing them to reuse code and produce higher-quality results.

f. Make sure that every commitment can be tracked

Traceability is another best practice for version control. Before and after the commit, the project should be able to build and pass its test cases. If the developer finds an issue and wants to figure out what changed to cause it, usually restore the working environment to a previous point to make sure the bug is still present. It is more challenging to track down a bug if earlier updates do not compile.

g. Best branching practices to follow

In version control, adhering to branching best practices is just as important. So, what is the optimal branching strategy?

There are numerous strategies.

Managing releases, new features, and bugs require the use of branches. However, branching can provide some difficulties. Changes in one branch, for example, must frequently propagate to other branches. It is vital to follow branching best practices to minimize merging conflicts, missing updates, and unintended overwriting of existing modifications.

h. Secure the Assets

Another recommended practice in version control is to use the appropriate security measures to safeguard the assets. The organization’s version control system is a critical repository. It stores and handles some of the company’s most valuable assets:

  • The intellectual property (IP) comprises source code for internal and external applications.
  • The product designs are fantastic.
  • Documentation for export or compliance.
  • Videos, graphics, or photos that developers have created.
  • Documents of the business.


Software development teams can use GitHub to communicate and keep track of all code changes. It can keep track of code changes, go back in time to fix mistakes, and share the work with other team members.

It is a place where Git projects can be stored. For those unfamiliar with Git, it is a distributed version control system. It is a free and open-source version control system with local branching, different workflows, and handy staging zones. Git version control is an easy-to-use option that provides for faster operation.

The standard Git command-line interface can be used to access and manage projects on; all standard Git commands work with it. Users can also look through public repositories on There are also several desktop clients and Git plugins available.

Git has a feature called a “worktree” that allows running numerous branches simultaneously. It accomplishes this by establishing a new directory that contains a copy of the git repository that is synchronized between the two directories in which it is stored.

To transport data, Git supports four different protocols: local, HTTP, Secure Shell (SSH), and Git.

The concept of “saving” in Git or other version control systems is more subtle than in a word processor or other typical file editing applications. In traditional software, the term “saving” is synonymous with the Git term “committing.” The Git counterpart of a “save” is a commit. Traditional saving is a file system procedure that allows to overwrite an existing file or create a new one. Git committing, on the other hand, is a procedure that affects a set of files and folders.

a. In git, what is a staging area?

“Untracked files” is another term for these files. The staging area contains files that will be part of the next commit, letting Git know what modifications will be made in the file for the next commit. All project commits are stored in the repository.

b. In git, what is stashing?

Local commits in the staging area and Git stashed resulted in this image. The git stash command stores and reverts the working copy’s uncommitted changes.

c. What is a local commit, and how does it work?

To save the modifications to the local repository, use the “commit” command. Before performing the “git commit” command, you must specifically tell Git which changes you wish to include in the commit. It means it will not be automatically included in the following commit just because a file has been updated.



Mishan Kavindu Perera

Software Engineering Undergraduate of Sri Lanka Institute of Information Technology