merging_handouts.tex 1.29 KB
Newer Older
1
2
\documentclass{article}

Laros's avatar
Laros committed
3
\providecommand{\handoutsTitle}{Combining changes by merging}
4

Laros's avatar
Laros committed
5
6
\usepackage{handouts}
\input{../shared/shared}
7

Laros's avatar
Laros committed
8
9
\begin{document}
\makeHeader
10

Laros's avatar
Laros committed
11
\subsubsection*{Fast-forward merging}
Mihai Lefter's avatar
Mihai Lefter committed
12
Edit again a file from the GitLab interface and run a \lstinline{git fetch} command on your local machine.
13
14
\bigskip

Mihai Lefter's avatar
Mihai Lefter committed
15
16
Inspect the commit graph with \lstinline{git log}.
\bigskip
17

Mihai Lefter's avatar
Mihai Lefter committed
18
Perform a fast-forward merge of the origin master branch into your local master branch.
19
20
\bigskip

Mihai Lefter's avatar
Mihai Lefter committed
21
\subsubsection*{A three-way merge with no conflicts}
Vermaat's avatar
Vermaat committed
22
The previous section produced a fast-forward merge.
23
24

\begin{itemize}
Mihai Lefter's avatar
Mihai Lefter committed
25
  \item \emph{Question:} Can you think of a way to get a three-way merge without conflicts?
26
\end{itemize}
Mihai Lefter's avatar
Mihai Lefter committed
27
28

Edit the same file on both your GitLab and local repositories (make sure that different lines are changed).
29
30
\bigskip

Mihai Lefter's avatar
Mihai Lefter committed
31
Run \lstinline{git fetch} on your local repository.
32
33
34

\begin{itemize}
  \item \emph{Question:} What does the commit graph of you repository look
Mihai Lefter's avatar
Mihai Lefter committed
35
    like now? Can you draw it on paper?
36
\end{itemize}
Mihai Lefter's avatar
Mihai Lefter committed
37
38
39

Perform a three-way merge and push to the GitLab remote repository.

Vermaat's avatar
Vermaat committed
40

Laros's avatar
Laros committed
41
\subsubsection*{Resolving a merge conflict}
Vermaat's avatar
Vermaat committed
42
43
44
45
Now do the same thing again (a three-way merge), but in such a way the merge
step will result in a merge conflict. Resolve the conflict in a way you feel
is appropriate.

46
\end{document}