The Ultimate Knowledge on GIT Version Control


We create lots and lots of software every now and then. It can be a very small tool or a big complex implementation. There would be working from one person to n number of team members in the same team at the same time.

If you are familiar with project management, you would know that each project is implemented in iterations — meaning, first implementing a few features and then a few more, and so on.

If you also know that team members working on the project would get changed from time to time when employees or team members leave the company or switch to another project, you’ll understand that maintaining consistency requires a common tool that can track the changes done by every team member.

Another use case: you might want to remove the latest changes done in the last one or two days because a recent change introduced a bug. To revert back to the stable version, you need a tool that tracks versions efficiently.

That tool is called Version Control.

There are different version control techniques used, some of the most common being Mercurial, Subversion, and GIT.

If you are interested in in-depth knowledge, you can follow here.

Table of Contents


History

GIT version control was created by Linus Torvalds in 2005. It is implemented in C, Shell, Perl, and TCL. It was initially created to handle the release of the Linux kernel, which Linus Torvalds had implemented back in 1991 as a replacement for UNIX.

Today, many operating systems are running on the Linux Kernel.

You can read more about GIT’s introduction here:
👉 Git - Wikipedia

If you are interested in hearing from the creator, watch this TED Talk by Linus Torvalds.


How GIT Is Better?

  • GIT is a distributed version control system. It can act as both a central repository and multiple local repositories.
  • If you are familiar with SVN version control, it requires an internet connection to commit the change — so if there are multiple contributors, it might slow down the network.
  • Whereas GIT can make a commit locally and push all the changes when you choose to do so. That’s why it’s easier to handle, and you can move to another task or feature seamlessly.
  • GIT also has branching capabilities — you can create a new branch to work on a feature, use it until you complete that feature, and merge it into the main branch once done. This ensures that your work doesn’t affect the main branch or other developers’ work.

GIT Servers

Since GIT version control is open source software, there are many projects created around it to make it easier to use in everyday work.

When you download GIT from its official site git-scm.com, it provides you with a command-line tool so you can start working right away.

But how about pushing your code to a server so that your whole team can access it easily?

If you have some shared hardware in your organization, you can create a GIT repository in it and share it with your team members. This won’t have a GUI, so all actions will be via the command line.

This was made easier with online tools like GitHub, Bitbucket, and GitLab. These tools manage the server, and you can use their web interface to perform operations easily — while still using all the native GIT commands.


Create Your Own GIT Server

It’s important for organizations to have control over their code. If the organization has resources, they might consider creating their own GIT server.

There are two main approaches:

1. Using Shared Directory

  1. Get one server with sufficient storage accessible within your organization.

  2. Create a directory with the project name.

  3. Inside that directory, run:

    git init --bare

Create Git Repo

This generates an empty GIT project.

  1. Use the pwd command to get the repository path.

PWD

  1. Share the path with your team, and they can use the git clone command to clone that repository locally.

Git Clone

And voila! You’ve just created a GIT server within your organization.

2. Self-hosting Gitlab

GitLab provides a unique experience for managing repositories. You can install the GitLab server code on a dedicated server and use it freely. Documentation For example, for Ubuntu: GitLab Installation for Ubuntu

While this gives you more control, it requires proper maintenance. If any vulnerabilities arise, you’ll need to handle them quickly. This option is best suited for organizations with enough resources to manage it.


Tags

If you’ve used Windows OS, you might be familiar with creating a restore point — to restore the system to a stable state if something goes wrong. Similarly, GIT has a tag feature. When you release a feature or version, always create a tag. Tags help you revert to stable releases if something breaks. GIT supports two types of tags:

  • Lightweight Tag: points to a specific commit.
  • Annotated Tag: contains the complete tag object.

Create a Lightweight Tag

git tag vName

Create an Annotated Tag

git tag -a vName -m "vName Tag"

List Tags

git tag

Checkout to a Tag Tags aren’t branches, so you need to create a new branch from the tag:

git checkout -b branchName tagName

Learn more here: Git - Tagging


Online Tools

There are several online tools that act as GIT servers and provide powerful features for teams. The most popular are Bitbucket, GitLab, and GitHub. These tools eliminate the need to maintain servers yourself — allowing you to focus on development.

Common features:

  • Free and premium plans
  • Unlimited public and private repositories
  • Pull requests, code reviews, and merges
  • Team and organization management
  • Tag and release creation
  • Automation triggers on new commits

Observations:

  • GitLab has a learning curve but is very powerful.
  • Bitbucket has a user-friendly front view.
  • GitHub offers detailed features like file review tracking.

Useful Links:


Software

To make working with GIT more convenient, you can use GUI (Graphical User Interface) tools instead of the command line.

Recommended tools:

  • SourceTree: Free tool for Mac and Windows. Fast, reliable, and full-featured.
  • TortoiseGit: Available for Windows only. Very intuitive interface. You can explore more GUI clients here: 👉 Git GUI Clients

Useful Commands

Here are some of the most useful GIT commands for your daily workflow:

ActionCommand
Initialize GIT projectgit init
Clone GIT projectgit clone <HTTP or SSH URL>
Create commitgit commit -m "Commit message"
Stage all changesgit add .
Stage specific filesgit add <file1 path> <file2 path>
Push to servergit push <remote> <branch name>
Examplegit push origin master
Rebase branchgit rebase -i <branch name>

You can explore more commands here: 👉 GIT Reference Guide


Learning Materials

Here are some great resources to dive deeper into GIT: Pro Git Book — by Scott Chacon & Ben Straub Git Tutorial on Codecademy Version Control with Git – Udacity Git Tutorial on TutorialsPoint


Conclusion

GIT version control is versatile and capable of handling large codebases and teams. You can modify GIT workflows to fit your project needs, using either the command line or GUI tools.

When your team knows how to use GIT properly, it brings ease of handling and peace of mind.

Each GIT platform has its own unique features — consider those based on your project requirements.

If you host your own server, remember that it requires constant maintenance to ensure security and reliability.

Though this article provides a comprehensive overview, GIT’s ecosystem is vast. Continue exploring through the provided learning materials to become a true GIT master.