Edit again a file from the GitLab interface and run a \lstinline{git fetch} command on your local machine.
\begin{enumerate}
\bigskip
\item How do you check your local git repository state since your last commit?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git state
\item git repository
\item git commit
\item git status
\item git show
\item git log
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item A branch is:
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item a file
\item a merge conflict
\item a pointer to a commit
\item always a problem
\item to enable collaboration
\item none of the above
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item What command is used in joining two or more development histories together:
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item join
\item combine
\item merge
\item pull
\item fork
\item intersect
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item What command displays the branches list:
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item show-branch
\item merge
\item display
\item branch
\item list
\item clone
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item Which of the following creates a new branch called \colorbox{gray!20}{brand\_new} and also checks it out?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git branch -c branch\_new
\item git new branch branch\_new
\item git status brand\_new
\item git checkout -b brand\_new
\item git commit brand\_mew
\item none of the above
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item In order to merge a branch into \colorbox{gray!20}{master} do we have to add and commit changes to that branch first?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item Yes
\item No
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item If we want to merge \colorbox{gray!20}{brand\_new} into \colorbox{gray!20}{master}, which branch should be checked out when we run the command \colorbox{gray!20}{git merge brand\_new}?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item brand\_new
\item any branch
\item master
\item none of the above
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item Which of the following commands will delete the branch \colorbox{gray!20}{brand\_new}:
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item it is impossible to delete a branch
\item git delete branch brand\_new
\item git head -d brand\_new
\item git branch -d brand\_new
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item You are in a detached head state when:
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item there is no head
\item the head points to the master branch
\item the head points to a commit
\item the head points to a different branch then the master branch
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\end{enumerate}
\section{Inspecting the commit graph}
In the following you will work with the repository present in \colorbox{gray!20}{$\sim$/practice\_repo}.
Please navigate to that directory and try to use the commands presented during the lecture (with their options accordingly) to perform the following tasks and answer the corresponding questions.
\item Merge branch \colorbox{gray!20}{documentation} into \colorbox{gray!20}{master}. What kind of merge was performed?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item fast-forward
\item try-and-leave
\item three-way
\item advanced
\end{enumerate}
\end{multicols}
\item Merge branch \colorbox{gray!20}{data} into \colorbox{gray!20}{master}. What kind of merge was performed?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item fast-forward
\item three-way
\item try-and-leave
\item advanced
\end{enumerate}
\end{multicols}
\end{enumerate}
\section{More commit graph manipulation}
You have already performed some merging in the previous section, but the repository state was beforehand prepared for you.
Next, you will make some file changes and manipulate the commit graph even further.
\subsection{Fast-forward merging}
Checkout branch \colorbox{gray!20}{data} and create a new branch called \colorbox{gray!20}{data-europe}.
Edit the \colorbox{gray!20}{capitals.txt} file by adding at the end some more european countries together with their capitals.
Checkout branch \colorbox{gray!20}{data} and perform a \textbf{fast-forward merge} of the \colorbox{gray!20}{data-europe} branch into \colorbox{gray!20}{data} branch.
\subsection{Three-way merging}
Branch \colorbox{gray!20}{data} should be checkedout. Correct the capital USA to Washington D.C. in the capitals.txt file and commit.
Checkout branch \colorbox{gray!20}{data-europe}. Add Paris as capital of France at the end of the file capitals.txt and commit.
Checkout branch \colorbox{gray!20}{data} and merge into it branch \colorbox{gray!20}{data-europe}.
A three-way merge without conflicts should have been performed.
\subsection{Resolving a merge conflict}
Checkout branch \colorbox{gray!20}{data}. Add Moscow as capital of Russia at the end of the file capitals.txt and commit.
Inspect the \textbf{commit graph} with \lstinline{git log}. Make sure you utilize the options described during the lecture.
Checkout branch \colorbox{gray!20}{data-europe} and add Madrid as the capital of Spain at the of the file capitals.txt and commit.
\bigskip
Perform a \textbf{fast-forward merge} of the \textbf{origin master} branch into your \textbf{local master} branch.
Checkout branch \colorbox{gray!20}{data} and merge into it branch \colorbox{gray!20}{data-europe}.
\bigskip
\subsubsection*{A three-way merge with no conflicts}
A merge conflict should have occurred. Solve it and commit.
The previous section produced a fast-forward merge. In the following you will perform a \textbf{three-way merge}.
\begin{itemize}
\subsection{Branch deletion}
\item\emph{Question:} Can you think of a way to get a three-way merge without conflicts?
\end{itemize}
Edit the same file on both your GitLab and local repositories (make sure that different lines are changed).
Delete branch \colorbox{gray!20}{data-europe}.
\bigskip
Run \lstinline{git fetch} on your local repository.
Merge branch \colorbox{gray!20}{data} into \colorbox{gray!20}{master}.
\begin{itemize}
Delete branch \colorbox{gray!20}{data}
\item\emph{Question:} What does the commit graph of you repository look
like now? Can you draw it on paper?
\end{itemize}
Perform a \textbf{three-way merge} and \textbf{push} to the GitLab remote repository.
\section{Solutions}
\bigskip
\begin{multicols}{6}
\begin{itemize}
\item 1.1 - d
\item 1.2 - c
\item 1.3 - c
\item 1.4 - d
\item 1.5 - d
\item 1.6 - a
\item 1.7 - c
\item 1.8 - d
\item 1.9 - d
\item 2.1 -
\item 2.2 -
\end{itemize}
\end{multicols}
\subsubsection*{Resolving a merge conflict}
Now do the same thing again (a three-way merge), but in such a way that the merge
step will result in a merge conflict. Resolve the conflict in a way you feel