Register to get access to 15+ free programming courses with interactive exercises

Introduction Git fundamentals


Regardless of the chosen language or area of development, code written by a programmer is no more than plain text written in multiple files. These files are regularly added, removed, and changed. And in the process of working on them, a lot of questions arise:

  • How do I not lose the source code?
  • How do I remember what I changed recently and where?
  • How do I protect myself from accidental changes and deletions?
  • How do I undo changes if they were incorrect?
  • How can two or more programmers work on the code simultaneously?

Imagine your project consists of hundreds of files and tens of thousands of lines of code. You do a task, and in the process you change 15 files and 300 lines of code, and suddenly it becomes clear that the task is no longer up to date. At this point, you need to return the source code to the state it was in before the changes. Another example - while working on your code, you realized that you made a change to the working project/site. A new task in a non-working state cannot be uploaded to the site, which means you must correct the version of the code that is from before you started working on the new task.

Collaborative development is its own headache too. If two programmers are working on tasks that require changes to the code in the same files, how can they do their work in such a way that they don't damage or overwrite the other developer's changes?

To solve all these and many other problems, programmers use the Git version control system. This is a special program that allows you to control changes in project files for both individual and collaborative code development. The basic features of Git include:

  • Returning to any version of the code from the past
  • View the history of changes and restore any data
  • Developers can work together without fear of losing data or messing up someone else's work

In today's world, Git has become the universal tool with which almost any development project starts. The entire current ecosystem of tools is built around Git (Git is integrated into all code editors) and the online services that integrate with it, such as GitHub or GitLab. As a rule, project code is stored on these sites, providing the team with both shared access and a copy in case of computer failure.

In this course, we will install Git and learn how to use its basic commands. Let's create our first repository and practice typical development tasks, such as adding, modifying or deleting files, and analyzing the project's history. Let's get acquainted with online code storage services and the open source movement.

The main source for mastering Git, besides the documentation, is the Pro Git book.

By the way, this course was also made in Git.


We recommend that you take courses on Hexlet in a certain order. This is important. The knowledge gained in one course helps you understand and master others. Git is run from the command line. And before you dive into Git, take or refresh your memory with a Command Line Fundamentals course. Then you won't be distracted from the current material and you'll get up to speed more quickly.

Аватары экспертов Хекслета

Are there any more questions? Ask them in the Discussion section.

The Hexlet support team or other students will answer you.

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

<span class="translation_missing" title="translation missing:">Bookmate</span>
<span class="translation_missing" title="translation missing:">Healthsamurai</span>
<span class="translation_missing" title="translation missing:">Dualboot</span>
<span class="translation_missing" title="translation missing:">Abbyy</span>
Suggested learning programs

From zero to a developer. Refunds in case you won't get a job

Frontend Developer icon
Development of front-end components for web applications
start anytime 10 months

Use Hexlet to the fullest extent!

  • Ask questions about the lesson
  • Test your knowledge in quizzes
  • Practice in your browser
  • Track your progress

Sign up or sign in

By sending this form, you agree to our Personal Policy and Service Conditions

Toto Image

Ask questions if you want to discuss a theory or an exercise. Hexlet Support Team and experienced community members can help find answers and solve a problem.