How revision control system restores revision?

algorithm, diff, git-diff, version-control

Solution

I know that source version control stores information only about differences.

As the question Git design decision on storing content rather than differences illustrates, this isn't exactly what Git does. It does has "packed" format though, to store objects in deltaified form, using binary delta from LibXDiff library. But that mainly is used for network transfer. See "Is the git binary diff algorithm (delta storage) standardized?". That is why git is "resolving delta" when you fetch.

Problem

My question is more general than declared in title. I know that source version control stores information only about differences. As I understand so does Wikipedia, and so does github. But they all have ability to show whole file with particular revision. Do they incrementally restore it from first revision to specific one? And another one question. If they store differences only, how they show them in ui with context (little bit text before and after changes). EDIT: github stores whole snapshots instead of deltas

Original source

Related problems