Home Git What is Git and how to install Git in Linux

What is Git and how to install Git in Linux

By sk
808 views

This brief guide explains what is Git, benefits of using Git, how it works, what is GitHub and how to install Git in Linux operating systems.

What is Git?

Git is a a popular distributed source control system or version control system used to track changes in the files or in source code of a project.

Git is an open source tool developed by Linus Torvalds in 2005 for the development of Linux Kernel source code. It is completely free to use and released under GNU General Public License Version 2.

Using Git, we can easily track changes in any set of files like who has changed the code, what has been changed and when has been changed etc. The changes can be shared with a remote repository.

Git is usually used for coordinating work among programmers collaboratively developing source code during software development. It doesn’t require any central system and most of the operations are local.

The developers can see the changes of each others, add new features, resolve issues together and also see the history of entire project as they build the application.

All the project's files as well as the history of changes made to those files are stored in a folder named Repository. Usually, a Git repository is consists of files, history, config managed by git.

Every project under the distributed version control system Git, goes through four stages. The four stages of Git are:

  • Working directory,
  • Staging area: pre-commit holding area,
  • Local repository,
  • Remote repository (GitHub, GitLab, BitBucket, TFS etc).

The following graphical illustration explains how Git works:

how Git works
how Git works

We will discuss each stage in detail when we learn about Git basics in the upcoming articles.

What is GitHub?

There are many hosting platforms allows you to host your Git repositories. GitHub is one of them.

GitHub is the most popular hosting platform for software development and version control using Git.

With the help of GitHub, one or more developers can work on a same project and also collaborate with other developers for different projects from anywhere in the World.

There are tens of thousands of projects are hosted in GitHub. It offers both free and paid plan. GitHub is owned by Microsoft corporation.

The other notable similar hosting platforms are GitLab, BitBucket, and AWS CodeCommit. Of course there are many hosting platforms exists. But these are well known platforms for remote hosting Git repositories.

Install Git On Linux

Git is available in the default repositories of most Linux distributions.

Install Git in Alpine Linux:

$ sudo apk add git

Arch Linux:

$ sudo pacman -S git

Debian, Ubuntu, Linux mint, Pop_OS!:

$ sudo apt install git

Fedora, RHEL, CentOS, AlmaLinux and Rocky Linux:

$ sudo dnf install git

openSUSE:

$ sudo zypper install git

Once installed, you can check the version of Git using command:

$ git --version
git version 2.31.1
Display Git version
Display Git version

As you can see in the above output, I have installed Git version 2.31.1.

In our upcoming tutorials, we will look into Git Fundamentals in more details.

Resource:

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More