2. What
is
Version
Control?
• Maintain
versions
of
sources
• Allows
for
collabora>on
• Tracking
progress
• Recording
history
2
3. Why
Version
Control?
• To
work
on
something
• Without
hindering
others
• Try,
fail
and
start
over
• Distribute
workload
3
4. Lingo
• Repository:
the
loca>on
that
acts
as
Version
Control
system
• Trunk:
the
lifeline
of
the
project
where
everything
starts
and
everything
ends
• Branch:
a
custom
lifeline
for
individual
tasks
or
collec>ve
works
• Tag:
a
label
to
iden>fy
something
in
>me
(like
a
version
or
milestone)
4
5. • Branching:
the
act
of
crea>ng
a
side
lifeline
for
a
specific
purpose
• Tagging:
the
act
of
labeling
an
event
in
>me
• Merging:
the
act
of
synchronizing
a
side
lifeline
with
his
parent
lifeline
• Integra6ng:
the
act
of
reuni>ng
the
side
lifeline
with
its
paren
lifeline
5
20. Why
sub-‐branching?
• Working
on
a
large
task
-‐ With
several
dependent
sub-‐tasks
• You
want
to
keep
related
sources
together
-‐ O^en
when
doing
versioning
• Try
stuff
out
20
29. Handle
complex
situa>ons
• Create
a
new
branch
for
the
project
-‐ This
will
be
your
own
trunk
-‐ Keep
it
in
sync
with
TRUNK
• For
each
itera>on
create
a
sub-‐branch
-‐ This
will
be
your
working
branch
-‐ Keep
it
in
sync
with
project
branch
• For
each
task
create
a
sub-‐branch
from
the
sub-‐branch
-‐ This
will
be
your
feature
branch
(playground)
-‐ Keep
it
in
sync
with
project
sub-‐branch
29
32. What
about
conflicts
• Conflicts
indicate
a
problem
-‐ Code
changed
on
same
posi>on
• What’s
“working”,
“le^”
and
“right”?
-‐ Working
is
the
current
situa>on
a^er
merge
with
your
code
-‐ Base
or
le^
is
the
code
before
merge
-‐ Head
or
right
is
incoming
changes
from
the
code
you
merge
with
32
33. //File: example.php
<<<<<<.working
$this->property = $newValue;
======
$this->property = $oldValue;
>>>>>>.r12345-right
Example
conflict
• By
opening
the
conflicted
file
-‐ look
what’s
in
conflict
-‐ discuss
with
developers
which
value
to
take
-‐ if
both
changes
are
required,
you
need
add
both
33
34. 34
Don’t solve conflicts yourself!
Always consult with all developers involved!
Changes made by one developer conflicting other developer’s
changes might require both changes to be implemented!
35. 35
Some
advice
• Commit
small
Ensure
your
commit
contains
one
task
• Commit
o=en
More
commits
build
up
history,
allowing
to
replay
changes
you
made
easily
to
parent
• Integrate
quick
Don’t
keep
sub-‐branches
alive
too
long,
the
sooner
they
are
reintegrated,
the
easier
it
is
to
merge
with
other
tasks