The core mission of a version control system is to enable
collaborative editing and sharing of data. But different
systems use different strategies to achieve this.
The Problem of File-Sharing
All version control systems have to solve the same
fundamental problem: how will the system allow users to share
information, but prevent them from accidentally stepping on
each other's feet? It's all too easy for users to
accidentally overwrite each other's changes in the
repository.
Consider the scenario shown in
Figure 2.2, “The problem to avoid”.
Suppose we have two co-workers, Harry and Sally. They each
decide to edit the same repository file at the same time. If
Harry saves his changes to the repository first, then it's
possible that (a few moments later) Sally could accidentally
overwrite them with her own new version of the file. While
Harry's version of the file won't be lost forever (because the
system remembers every change), any changes Harry made
won't
be present in Sally's newer version
of the file, because she never saw Harry's changes to begin
with. Harry's work is still effectively lost—or at
least missing from the latest version of the file—and
probably by accident. This is definitely a situation we want
to avoid!