What are sets of changes in Git
Changeset is for Changeset , which is not related to how Git keeps changes. >
Changeset is a fundamental concept of Git and is also present in many other source code control systems.
The basic idea of a changeset is to commit a set of changes in an atomic way, ie: either all set changes are committed successfully, or none are. We can make an analogy with a database transaction that either guarantees the persistence of multiple records at once, or rolls back in case the persistence of one of the records fails.
It's a fact that changesets in Git go beyond changesets in other version control systems. In git you can, for example, change a changeset in the repository! That is, in Git you can modify the history of the changes that have taken place. Of course, there are scenarios where this applies and there are restrictions, but this is another story.
How does Git save changes?
Outbound, it saves similarly to many other version control systems: When a changeset arrives, only the changeset files are saved. Files that were not changed remain there as they were. At each commit Git registers a snapshot , which is the state of the repository as it was after this commit.
As with other versioning systems, you can request the state of the repository at any point in the past, that is: you request a given snapshot. What Git will then give you are the files committed at the time of the snapshot's registration and all the files that were already there before, those that were not modified by the commit that gave rise to the snapshot.
No, Git does not only commit changes to each file in the commit act. At the commit commit, Git saves the entire contents of the file, not just the modifications made to the file .
Is it correct to say that Git is able to save only the differences between commits from the same file instead of having to keep the entire file even if only one row has been modified?
Yes, it is correct. In due course, Git will make a kind of garbage collection and, among other things, it will also erase some historical files by replacing them with only the changes that occurred in those files between one commit and another (< in> Delta Encoding ). You can also force this process when you want.
It is important to note that during garbage collection, Git does not replace the files of the new commits with their delta encoding but rather the reverse: it gets the changes from the most current state of the file to back, in order to deliver faster the latest version of the file (which is probably the one you will most often want).
Conclusion
Changeset or Changeset is a concept that deals with commit atomicity and is not directly related to the way Git saves files. Git is one of many versioning systems that use this concept of changeset.
During the commit, Git saves all the contents of the changed file , regardless of whether the file has been slightly modified (just a new line, for example).
Git does not need to save a copy of the repository with every commit to ensure the repository's availability in some past state. Instead, during the commit it registers a snapshot that points to the newly committed files and also to the current versions of the other files that were already there.
At appropriate times, Git rearranges its base in order to save space ( garbage collection ). During this reorganization, past versions of a file can be overwritten by records only of changes that the file underwent ( delta encoding ). So, when an older version is requested, Git rebuilds the file from its most current version, applying changes in it to the older version.