3 ms·
Logically, yes, git is a list of snapshots over time. There are two issues that you touch on here, though. One is data storage. There is nothing stopping git f
by andrewla 3y ago
Logically, yes, git is a list of snapshots over time.
There are two issues that you touch on here, though. One is data storage. There is nothing stopping git from storing those snapshots as deltas from previous snapshots, so long as it is able to reproduce the tree at any point in time with bitwise fidelity.
Already, internally, git will store deltas to compress the store instead of storing content for each changed file.
And at display time, it can make inferences about what has changed between two snapshots. So over time history gets "better" as it tracks file and line moves better just by making better heuristics around how to present changes to the user.
The main defect you point out is the immutability of history, especially when it comes to deleting history. I don't really have an answer for that, and I'm not sure that this is a solvable problem when you have a distributed version control system -- no matter how much you try to purge something, someone somewhere can have a copy of the unpurged repository so the idea of a definitive "delete" sounds incompatible with a distributed vcs.