Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Git, what does delta mean? [duplicate]

Tags:

git

I'm new to Git. Today I pulled a branch via git terminal and got the following message:

remote: Counting objects: 5, done.

remote: Compressing objects: 100% (3/3), done.

remote: Total 3 (delta 2), reused 0 (delta 0)

Unpacking objects: 100% (3/3), done.

What does delta mean?

like image 566
user1941537 Avatar asked Sep 18 '19 11:09

user1941537


People also ask

What does delta mean in git?

Git uses Delta encoding which indicates a way of storing or transmitting data in the form of differences (deltas) between sequential data rather than complete files. An object in a pack is stored as a delta i.e. a sequence of changes to make to some other object.

What is resolving deltas in git clone?

In summary, the "resolving deltas" stage involves decompressing and checksumming the entire repo database, which not surprisingly takes quite a long time. Presumably decompressing and calculating SHA1s actually takes more time than applying the delta commands.

Does git use Delta?

Git uses delta compression to efficiently store the objects when it creates pack files. This is an implementation detail about the compression algorithm used -- it's completely immaterial to using git.

What is git delta compression?

Delta compression (also called delta encoding, or just delta coding), is where only the differences to a known base file is stored, discarding any similarities. To decompress this, you apply the stored changes (also called “diffs”) to the base file, leaving you with the new file.


2 Answers

Ok, so first we need need understand how Git stores data within repository. The most important thing there is that it always store whole files, in other words on conceptual level, Git store "exact copy" of the project tree in the each commit.

Ok, but how it happens that each commit do not increase repository size by new copy of whole tree you may ask. This is where magic happens. First lets see that we have 2 files currently in tree and committed

a.txt
b.txt

When we change b.txt but leave a.txt as is, we do not need to store whole new copy of a.txt, just point to the old one (as it hash hasn't changed).

But let's go one step further, we do not need to store whole b.txt file either, just part that has changed. So let's split b.txt into chunks of known size and make b.txt node just list of these chunks. In that way we can store repeated chunks only once, and save space. And each of these "chunks" is called delta.

like image 89
Hauleth Avatar answered Oct 21 '22 21:10

Hauleth


Git uses Delta encoding which indicates a way of storing or transmitting data in the form of differences (deltas) between sequential data rather than complete files.

An object in a pack is stored as a delta i.e. a sequence of changes to make to some other object.

You can read more here for better understanding .

like image 33
naib khan Avatar answered Oct 21 '22 22:10

naib khan