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?
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.
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.
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.
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.
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.
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 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With