Before Starting development a copy of what is to
be changed is taken from the repository This can either be checked
out or left checked in.
If the code is checked out other users will not
be able to make any changes to the that piece of code. This
is fine for small teams and if exclusive access is required ,
however forgetting to check back in can cause multiple issues for
the rest of the development team.
More commonly now Nothing is checked out, A
working copy is made and then after all changes are created,
the code is merged back into the repository. Any conflicts are then
resolved at that point.
When embarking on a change, a developer takes a
copy of the current code base on which to work. As other developers
submit changed code to the source code repository, this copy
gradually ceases to reflect the repository code. Not only can the
existing code base change, but new code can be added as well as new
libraries, and other resources that create dependencies, and
potential conflicts.
The longer a branch of code remains checked out,
the greater the risk of multiple integration conflicts and failures
when the developer branch is reintegrated into the main line. When
developers submit code to the repository they must first update
their code to reflect the changes in the repository since they took
their copy. The more changes the repository contains, the more work
developers must do before submitting their own changes.
Eventually, the repository may become so
different from the developers' baselines that they enter what is
sometimes referred to as "merge hell", or "integration hell", where
the time it takes to integrate exceeds the time it took to make
their original changes.
Continuous integration involves integrating early
and often, so as to avoid the pitfalls of "integration hell". The
practice aims to reduce rework and thus reduce cost and time.
A complementary practice to CI is that before
submitting work, each programmer must do a complete build and run
(and pass) all unit tests. Integration tests are usually run
automatically on a CI server when it detects a new commit.