Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
courses
Git course
Commits
df4c66e8
Commit
df4c66e8
authored
Sep 05, 2017
by
Mihai Lefter
Browse files
Merging handouts draft.
parent
cc833e67
Changes
1
Hide whitespace changes
Inline
Side-by-side
merging/merging_handouts.tex
View file @
df4c66e8
...
...
@@ -8,62 +8,35 @@
\begin{document}
\makeHeader
\subsubsection*
{
Setting the stage
}
In this practical, you'll work with the repository your neighbour created
during the previous practical. We'll refer to this repository as
{
\bf
N
}
, and
to your own repository from the previous practical as
{
\bf
Y
}
.
\bigskip
Clone his or her repository to your local machine. Make sure to do this in a
separate directory.
\bigskip
After you and your neighbour both cloned eachother's repositories:
\begin{enumerate}
\item
Add a new commit to repository
{
\bf
Y
}
on GitLab (so the one your
neighbour just cloned).
\item
Wait for eachother before continuing.
\item
Update your clone of
{
\bf
N
}
with
\lstinline
{
git fetch
}
.
\end{enumerate}
\bigskip
\emph
{
Question:
}
What does the commit graph of your repository look like? Can
you draw it on paper?
\bigskip
\emph
{
Hint:
}
Use
\lstinline
{
git log
}
with the appropriate arguments.
\bigskip
\subsubsection*
{
Fast-forward merging
}
Of course we want the nice commit your neighbour just made in our
\lstinline
{
master
}
branch.
Edit again a file from the GitLab interface and run a
\lstinline
{
git fetch
}
command on your local machine.
\bigskip
Merge the remote
\lstinline
{
master
}
branch into
\lstinline
{
master
}
.
Inspect the commit graph with
\lstinline
{
git log
}
.
\bigskip
\begin{itemize}
\item
\emph
{
Question:
}
What does the commit graph of you repository look
like now?
\end{itemize}
Perform a fast-forward merge of the origin master branch into your local master branch.
\bigskip
\subsubsection*
{
A three-way merge
}
\subsubsection*
{
A three-way merge
with no conflicts
}
The previous section produced a fast-forward merge.
\bigskip
\begin{itemize}
\item
\emph
{
Question:
}
Can you think of a way to get a three-way merge?
\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).
\bigskip
Together with your neighbour, manipulate your repository in such a way that
the commit graph contains a merge commit (created by a three-way merge).
Run
\lstinline
{
git fetch
}
on your local repository.
\begin{itemize}
\item
\emph
{
Question:
}
What does the commit graph of you repository look
like now?
like now?
Can you draw it on paper?
\end{itemize}
\bigskip
Perform a three-way merge and push to the GitLab remote repository.
\subsubsection*
{
Resolving a merge conflict
}
Now do the same thing again (a three-way merge), but in such a way the merge
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment