GIT is a software for managing the development of various IT projects. It is a distributed version control system created by Linus Torvalds and introduced to the world in 2005. The original purpose of GIT was to control the writing of the Linux kernel. This software is distributed as free software and is licensed under the GNU GPL (second version).

Why do you need GIT? During the development of any software, the written code is tested. This is necessary to check whether the actual result of executing a set of commands is as expected. There may be several versions of a certain part or the entire project that implement different functionality.

First, this is due to changing requirements, adding new functionality, and fixing bugs in the code. Secondly, and most importantly, entire teams of programmers work on modern IT projects. There is a need to go back to earlier versions of the code, to find out who made certain changes and when.

To begin with, you need to install this VCS, which is possible on any popular platform:

  • On Windows, you need to download the program from the official website and install it using the visual interface of this OS. To configure it, open the command line and enter the following commands: git config –global user.name “User name” and git config –global user.email “Email”.
  • MacOS GIT may already be installed. To check, open a terminal and enter the git -version command. If the software is not installed, you should follow the same steps as for Windows.
  • On Unix systems (Debian or Ubuntu), the installation is performed through the terminal. To do this, enter the following commands: sudo apt-get update and sudo apt-get install git. User settings are entered using the above commands (as for Windows and MacOS).
  • The basis of any CVS is a repository. The user must be able to create, configure, and clone repositories. To make the selected directory a repository, run the following command: git init directory. To clone an existing directory, run the command git clone path_to_directory. Many hosting providers provide a convenient visual interface for performing the above operations.

The structure of the repository:

  • Working directory – a folder containing data files;
  • Index – an intermediate data storage where all changes are temporarily stored before they are finally applied;
  • HEAD – a pointer to the last commit.

The essence of working with GIT:

  • Upload a new file (git add file) or make changes that are stored in the Index.
  • Review and analyze current changes, apply to HEAD (git commit -m “comment on commit”).

Sending all changes to the repository (git push origin branch name). If you need to establish a connection between the current repository and a remote server, enter the command git remote add origin server_name.

GIT supports the so-called branches, which are branches of different versions of the same project. This is necessary to implement new features that should not affect other logic. There is a main branch and separate branches (in any number). To create them, use the command git checkout -b branch name, and to delete them, use git checkout -d branch name. If you need to return to the development of the main branch of the project, use the git checkout master command. Opening access to a new branch for other developers is possible with the git push origin branch_name command.

Any updates or revisions to the software should be labeled or tagged to simplify further work with them. For this purpose, use the git tag 1.1.0 first_10_characters_commit-id command. This identifier is located in the log, which can be viewed using the git log command with different keys.