Skip to content
Snippets Groups Projects
Commit ef5f35f8 authored by Vermaat's avatar Vermaat
Browse files

Update handouts

parent 9392ae2f
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ Git Basics practical.
First, create an empty directory and use ``\texttt{git init}'' to make a new
repository.
\begin{itemize}
\item \emph{Hint:} Use a unique name for the directory, different from your
neighbour (this is convenient later).
\item \emph{Question:} How can you see that you are working in a Git
repository?
\end{itemize}
......
......@@ -9,65 +9,53 @@
\begin{center}
{\bf Git Introduction Course}
Working with branches in Git practical.
Combining changes by merging practical.
\end{center}
\bigskip
\subsubsection*{Inspect the commit graph.}
We'll work from the repository you created in the previous practical.
\begin{itemize}
\item \emph{Question:} What is your current branch and what is the hash of
the commit it points to?
\item \emph{Question:} What does the commit graph of you repository look
like? Can you draw it on paper?
\end{itemize}
\emph{Hint:} Use \texttt{git log} with the appropriate arguments.
\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
As an alternative to \texttt{git log}, you can also try a graphical viewer
such as \texttt{gitg} (installed on the course laptops) or \texttt{gitk}.
Clone his or her repository to your local machine. Make sure to do this in a
separate directory.
\bigskip
\subsubsection*{Implement a feature in a new branch.}
Let's do some real work (e.g., add some documentation to the project).
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 \texttt{git fetch}.
\end{enumerate}
\bigskip
Start by creating a branch for your work (give it a descriptive name) and
switch to it.
\begin{itemize}
\item \emph{Question:} What branches are there now and what are the commits
they point to?
\end{itemize}
\emph{Question:} What does the commit graph of your repository look
like? Can you draw it on paper?
\bigskip
Implement your feature (e.g. write documentation) and commit your changes.
\begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look
like now?
\end{itemize}
\emph{Hint:} Use \texttt{git log} with the appropriate arguments.
\bigskip
\subsubsection*{Merge your feature.}
Of course we want this nice feature in our \texttt{master} branch.
As an alternative to \texttt{git log}, you can also try a graphical viewer
such as \texttt{gitg} (installed on the course laptops) or \texttt{gitk}.
\bigskip
\begin{itemize}
\item \emph{Question:} If you want to merge branch \texttt{B} into branch
\texttt{A}, what should be your current branch?
\end{itemize}
\subsubsection*{Fast-forward merging.}
Of course we want the nice commit your neighbour just made in our
\texttt{master} branch.
\bigskip
Merge your feature branch into \texttt{master}.
Merge the remote \texttt{master} branch into \texttt{master}.
\begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look
......@@ -76,13 +64,8 @@ Merge your feature branch into \texttt{master}.
\bigskip
Since you merged it, you can now delete the feature branch.
\bigskip
\subsubsection*{A three-way merge.}
Unless you were extremely zealous, the last section produced a fast-forward
merge.
The previous section produced a fast-forward merge.
\bigskip
......@@ -92,12 +75,20 @@ merge.
\bigskip
Manipulate your repository in such a way that the commit graph contains a
merge commit (created by a three-way merge).
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).
\begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look
like now?
\end{itemize}
\bigskip
\subsubsection*{Resolving a merge conflict.}
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.
\end{document}
......@@ -20,10 +20,6 @@ Please take the following into account with respect to our GitLab server:
\item If you don't have an LUMC account, ask us to create a GitLab account
for you and select {\em Standard} instead of {\em LDAP} on the login
page.
\item Due to the LUMC firewall, accessing repositories using SSH is only
possible from the LUMC network (and not from the LUMC gast network). As an
alternative, you can always use HTTPS but the downside is that you have to
keep repeating your password.
\item Our GitLab server is very similar (in fact, it is a clone) to the
popular online GitHub (\texttt{https://github.com}) and Bitbucket
(\texttt{https://bitbucket.org}) services.
......@@ -32,11 +28,17 @@ Please take the following into account with respect to our GitLab server:
\bigskip
\subsubsection*{Add your repository to GitLab.}
\begin{quote}
(If you don't have a repository on your local machine from the previous
practical, create one now with at least one commit.)
\end{quote}
Now you have a nice repository, of course you want to share it on GitLab.
\bigskip
Go to GitLab (\texttt{https://git.lumc.nl}) and create a new project.
Go to GitLab (\texttt{https://git.lumc.nl}) and create a new project (use the
same name you used to store your repository locally).
\begin{itemize}
\item \emph{Question:} What is the repository URL for your new project?
......@@ -48,7 +50,7 @@ Add the GitLab repository as a remote to your local repository.
\bigskip
Push your branch(es) to GitLab.
Push your commits to GitLab.
\begin{itemize}
\item \emph{Question:} Can you see your repository content in the GitLab web
......@@ -57,54 +59,25 @@ Push your branch(es) to GitLab.
\bigskip
\subsubsection*{Clone an existing repository from GitLab.}
There already are some nice repositories on GitLab! Pick one (e.g., from the
person sitting next to you, or browse the public repositories using the globe
icon in the top right).
\bigskip
Create a local clone of the repository you picked.
\begin{itemize}
\item \emph{Question:} In the resulting repository, what remotes and
branches exist?
\end{itemize}
\bigskip
\subsubsection*{Create a merge request.}
If you are interested, here are some additional GitLab features you can
use. Fork an existing project, implement a feature, and submit a merge
request.
\emph{Hint:} Use \texttt{git push} once with the \texttt{-u} flag so you can
use the \texttt{git push/pull} shortcuts.
\bigskip
Find an interesting project and click the \emph{Fork} button. This makes a
copy of the project under your own user, on GitLab.
\subsubsection*{More synchronisation.}
Look for a way to edit a file directly from the GitLab web interface (in your
browser) and do this at least once.
\bigskip
Clone the project (your fork) to your local machine.
Update your local copy of the file with the change you just made (by fetching
and merging).
\bigskip
Create a new branch and implement some feature in it. Make sure to commit
this.
\bigskip
Push your new branch to GitLab (your fork of the project).
\bigskip
If you now go to your GitLab dashboard (homepage), you'll see a green button
to create a merge request. From the merge request, the owner of the original
project can directly merge your changes using only the web interface.
\bigskip
Now make another commit locally and push it to the GitLab server. Verify that
all these changes are now present both on your local machine and on the GitLab
server.
\emph{Hint:} You can also start a discussion or do some code review inside the
merge request.
\end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment