All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

What is a commit in the context of programming and SCM / Git?

Post cover: What is a commit in the context of programming and SCM / Git?
This content has been automatically translated from Ukrainian.
Commit (English "commit") in the context of the Git version control system is a key concept that means saving changes in the local repository. It is a kind of snapshot of the current state of the project, which includes changes in code, configuration files, documentation, and other resources. Each commit creates a new version of the project that can be restored or viewed at any moment.
The word "commit" comes from the English language, where it means "to carry out," "to commit," "to decide," or "to fix." In the context of Git, this word reflects the essence of the process of fixing changes that become part of the project's history. This fixation is immutable, meaning that after a commit is created, its content remains constant, and it cannot be changed without creating a new commit (this is a simplified explanation, of course, data and commits can be manipulated in various ways).
Git is a version control system (SCM, or Source Control Management) that was created by Linus Torvalds in 2005, initially for managing the development of the Linux kernel. Git is a distributed system that allows each developer to have a complete copy of the project's history on their computer. This provides high flexibility in working with code, the ability to work offline, and independence from a central server.
скріншот історії комітів репозиторію проєкту forem на GitHub
скріншот історії комітів репозиторію проєкту forem на GitHub
To make a commit in Git, you first need to prepare the changes by adding them to the index (staging area). This is done with the command git add, which adds the selected files to the index. After that, the command git commit fixes these changes in the form of a commit, adding a message that describes the changes made. For example, the command git commit -m "Updated README and added a new section on configuration" will create a commit with the corresponding message. It is possible to create an empty commit, but you can read about it here.
The process of creating a commit is important for tracking the development of the project. Each commit stores information about the author, the time of the changes made, and a message explaining what exactly was changed. This not only allows for preserving the project's history but also facilitates teamwork, where each participant can see who made certain changes and when, and why they were made. In case of mistakes or the need to revert to a previous version of the code, commits allow for easy recovery, preserving all intermediate versions.
A commit is an integral part of working with Git, allowing for effective management of changes in the project, preserving its history, and ensuring the ability to track and control all changes made.

This post doesn't have any additions from the author yet.

How does the map method work in Ruby? An overview of the method's operation with examples.
30 Jul 07:33

How does the map method work in Ruby? An overview of the method's operation with examples.

meme code
meme code@memecode
What does a dot at the beginning of a file (.gitignore, .DS_Store, .bashrc, etc.) mean?
02 Aug 13:15

What does a dot at the beginning of a file (.gitignore, .DS_Store, .bashrc, etc.) mean?

meme code
meme code@memecode
What is .gitignore? What is it for and how to use it
02 Aug 14:58

What is .gitignore? What is it for and how to use it

meme code
meme code@memecode
How to remove the .DS_Store file from a Git repository?
02 Aug 19:34

How to remove the .DS_Store file from a Git repository?

meme code
meme code@memecode
What is an idempotent method?
21 Aug 20:57

What is an idempotent method?

meme code
meme code@memecode
What is a repository?
21 Aug 21:25

What is a repository?

meme code
meme code@memecode
What is SCM (Source Control Management)?
21 Aug 21:46

What is SCM (Source Control Management)?

meme code
meme code@memecode
What hierarchy does the DOM (Document Object Model) have?
23 Aug 09:22

What hierarchy does the DOM (Document Object Model) have?

meme code
meme code@memecode
How does an artificial intelligence model work?
15 Sep 16:42

How does an artificial intelligence model work?

meme code
meme code@memecode
What does relational mean (in the context of relational databases)?
21 Sep 08:27

What does relational mean (in the context of relational databases)?

meme code
meme code@memecode
What is an RDBMS (relational database management system)?
21 Sep 08:56

What is an RDBMS (relational database management system)?

meme code
meme code@memecode
What does the ACID principle mean in programming?
24 Sep 20:31

What does the ACID principle mean in programming?

meme code
meme code@memecode