Commit 553f081a authored by Mihai's avatar Mihai

Update commit graph lecture

parent 48f3229a
...@@ -437,6 +437,13 @@ ...@@ -437,6 +437,13 @@
\end{center} \end{center}
\end{pframe} \end{pframe}
\subsection{No }
error: Your local changes to the following files would be overwritten by merge:
data/capitals.txt
Please, commit your changes or stash them before you can merge.
Aborting
\subsection{Deleting branches} \subsection{Deleting branches}
\begin{pframe} \begin{pframe}
Old branches that have been merged can be deleted. Old branches that have been merged can be deleted.
......
...@@ -34,39 +34,39 @@ ...@@ -34,39 +34,39 @@
\begin{multicols}{3} \begin{multicols}{3}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
\item a file \item a file
\item a merge conflict
\item a pointer to a commit
\item always a problem \item always a problem
\item to enable collaboration \item a pointer to a commit
\item a merge conflict
\item where leaves could grow
\item none of the above \item none of the above
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\vspace{-0.3cm} \vspace{-0.3cm}
\item What command is used in joining two or more development histories together: \item What command could be used in joining two or more development histories (branches) together?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{3} \begin{multicols}{3}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
\item join \item git join
\item combine \item git combine
\item merge \item git merge
\item pull \item git pull
\item fork \item git fork
\item intersect \item git intersect
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\vspace{-0.3cm} \vspace{-0.3cm}
\item What command displays the branches list: \item Which of the following commands displays the branches list?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{3} \begin{multicols}{3}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
\item show-branch \item git show-branch
\item merge \item git merge
\item display \item git display
\item branch \item git branch
\item list \item git list
\item clone \item git clone
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\vspace{-0.3cm} \vspace{-0.3cm}
...@@ -85,12 +85,12 @@ ...@@ -85,12 +85,12 @@
\end{multicols} \end{multicols}
\vspace{-0.3cm} \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? \item In order to merge a branch into another one do we have to add and commit changes first?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{2} \begin{multicols}{2}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
\item Yes \item yes
\item No \item no
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\vspace{-0.3cm} \vspace{-0.3cm}
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
\end{multicols} \end{multicols}
\vspace{-0.3cm} \vspace{-0.3cm}
\item Which of the following commands will delete the branch \colorbox{gray!20}{brand\_new}: \item Which of the following commands will delete the branch \colorbox{gray!20}{brand\_new}?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{2} \begin{multicols}{2}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
...@@ -135,7 +135,7 @@ ...@@ -135,7 +135,7 @@
\section{Inspecting the commit graph} \section{Inspecting the commit graph}
In the following you will work with the repository present in \colorbox{gray!20}{$\sim$/practice\_repo}. In the following you will work with the repository present in \colorbox{gray!20}{$\sim$/commit-graph-practical}.
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. 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.
\begin{enumerate} \begin{enumerate}
...@@ -150,13 +150,33 @@ Please navigate to that directory and try to use the commands presented during t ...@@ -150,13 +150,33 @@ Please navigate to that directory and try to use the commands presented during t
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\item Are you in a detached head state?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item yes
\item no
\end{enumerate}
\end{multicols}
\item What branch is active (checked out)?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item data
\item data-europe
\item documentation
\item master
\end{enumerate}
\end{multicols}
\item The commit graph looks like: \item The commit graph looks like:
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{center} \begin{center}
\includegraphics[width=\textwidth]{images/initial_practical_graph.pdf} \includegraphics[width=\textwidth]{images/initial_practical_graph.pdf}
\end{center} \end{center}
\item Merge branch \colorbox{gray!20}{documentation} into \colorbox{gray!20}{master}. What kind of merge was performed? \item What merge type is performed if branch \colorbox{gray!20}{documentation} is merged into \colorbox{gray!20}{master}?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{2} \begin{multicols}{2}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
...@@ -166,8 +186,10 @@ Please navigate to that directory and try to use the commands presented during t ...@@ -166,8 +186,10 @@ Please navigate to that directory and try to use the commands presented during t
\item advanced \item advanced
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\item Merge branch \colorbox{gray!20}{documentation} into \colorbox{gray!20}{master}.
\item Merge branch \colorbox{gray!20}{data} into \colorbox{gray!20}{master}. What kind of merge was performed? \item What merge type is performed if branch \colorbox{gray!20}{documentation} is merged into \colorbox{gray!20}{master}?
\vspace{-0.2cm} \vspace{-0.2cm}
\begin{multicols}{2} \begin{multicols}{2}
\begin{enumerate}[label=(\alph*)] \begin{enumerate}[label=(\alph*)]
...@@ -177,6 +199,8 @@ Please navigate to that directory and try to use the commands presented during t ...@@ -177,6 +199,8 @@ Please navigate to that directory and try to use the commands presented during t
\item advanced \item advanced
\end{enumerate} \end{enumerate}
\end{multicols} \end{multicols}
\item Merge branch \colorbox{gray!20}{documentation} into \colorbox{gray!20}{master}.
\end{enumerate} \end{enumerate}
...@@ -188,41 +212,96 @@ Next, you will make some file changes and manipulate the commit graph even furth ...@@ -188,41 +212,96 @@ Next, you will make some file changes and manipulate the commit graph even furth
\subsection{Fast-forward merging} \subsection{Fast-forward merging}
Checkout branch \colorbox{gray!20}{data} and create a new branch called \colorbox{gray!20}{data-europe}. \begin{enumerate}
\item 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. \vspace{-0.1cm}
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. \item Edit the \colorbox{gray!20}{data/capitals.txt} file by adding at the end Rome as Italy's capital (``Italy:Rome'').
\vspace{-0.1cm}
\subsection{Three-way merging}
\item Stage and commit the changes.
Branch \colorbox{gray!20}{data} should be checkedout. Correct the capital USA to Washington D.C. in the capitals.txt file and commit. \vspace{-0.1cm}
Checkout branch \colorbox{gray!20}{data-europe}. Add Paris as capital of France at the end of the file capitals.txt and commit. \item Checkout branch \colorbox{gray!20}{data} and merge the \colorbox{gray!20}{data-europe} branch into it.
\item Why was the previous merge a fast-forward one?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item it was not
\item the branches did not diverge yet
\item different commits
\item none of the above
\end{enumerate}
\end{multicols}
\end{enumerate}
Checkout branch \colorbox{gray!20}{data} and merge into it branch \colorbox{gray!20}{data-europe}. \subsection{Three-way merging without conflicts}
A three-way merge without conflicts should have been performed. \begin{enumerate}
\item Make sure branch \colorbox{gray!20}{data} is active (checkedout).
\vspace{-0.1cm}
\item Correct the USA capital to Washington D.C. in the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.1cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data-europe}.
\vspace{-0.1cm}
\item Add Paris as capital of France at the end of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.1cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data} and merge into it the \colorbox{gray!20}{data-europe} branch.
\end{enumerate}
\subsection{Resolving a merge conflict} \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. \begin{enumerate}
\item Make sure branch \colorbox{gray!20}{data} is active (checkedout).
Checkout branch \colorbox{gray!20}{data-europe} and add Madrid as the capital of Spain at the of the file capitals.txt and commit. \vspace{-0.1cm}
Checkout branch \colorbox{gray!20}{data} and merge into it branch \colorbox{gray!20}{data-europe}. \item Add Moscow as capital of Russia at the end of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.1cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data-europe}.
\vspace{-0.1cm}
\item Add Madrid as Spain's capital at the of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.1cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data} and merge into it the \colorbox{gray!20}{data-europe} branch.
\vspace{-0.1cm}
\item Solve the merge conflict that was created during the previous step.
\end{enumerate}
A merge conflict should have occurred. Solve it and commit.
\subsection{Branch deletion} \subsection{Branch deletion}
Delete branch \colorbox{gray!20}{data-europe}. \begin{enumerate}
\item Delete the \colorbox{gray!20}{data-europe} branch.
Merge branch \colorbox{gray!20}{data} into \colorbox{gray!20}{master}. \end{enumerate}
Delete branch \colorbox{gray!20}{data} \vspace{1.5cm}
\section{Solutions} \section{Solutions}
\vspace{-0.1cm}
\begin{multicols}{6} \begin{multicols}{6}
\begin{itemize} \begin{itemize}
\item 1.1 - d \item 1.1 - d
...@@ -233,9 +312,14 @@ Delete branch \colorbox{gray!20}{data} ...@@ -233,9 +312,14 @@ Delete branch \colorbox{gray!20}{data}
\item 1.6 - a \item 1.6 - a
\item 1.7 - c \item 1.7 - c
\item 1.8 - d \item 1.8 - d
\item 1.9 - d \item 1.9 - c
\item 2.1 - \item 2.1 - d
\item 2.2 - \item 2.2 - b
\item 2.3 - d
\item 2.4 - c
\item 2.5 - a
\item 2.7 - b
\item 3.1.5 - b
\end{itemize} \end{itemize}
\end{multicols} \end{multicols}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment