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.