Commit ef5f35f8 authored by Vermaat's avatar Vermaat
Browse files

Update handouts

parent 9392ae2f
...@@ -17,6 +17,8 @@ Git Basics practical. ...@@ -17,6 +17,8 @@ Git Basics practical.
First, create an empty directory and use ``\texttt{git init}'' to make a new First, create an empty directory and use ``\texttt{git init}'' to make a new
repository. repository.
\begin{itemize} \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 \item \emph{Question:} How can you see that you are working in a Git
repository? repository?
\end{itemize} \end{itemize}
......
...@@ -9,65 +9,53 @@ ...@@ -9,65 +9,53 @@
\begin{center} \begin{center}
{\bf Git Introduction Course} {\bf Git Introduction Course}
Working with branches in Git practical. Combining changes by merging practical.
\end{center} \end{center}
\bigskip \bigskip
\subsubsection*{Inspect the commit graph.} \subsubsection*{Setting the stage.}
We'll work from the repository you created in the previous practical. 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
\begin{itemize} to your own repository from the previous practical as {\bf Y}.
\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.
\bigskip \bigskip
As an alternative to \texttt{git log}, you can also try a graphical viewer Clone his or her repository to your local machine. Make sure to do this in a
such as \texttt{gitg} (installed on the course laptops) or \texttt{gitk}. separate directory.
\bigskip \bigskip
\subsubsection*{Implement a feature in a new branch.} After you and your neighbour both cloned eachother's repositories:
Let's do some real work (e.g., add some documentation to the project). \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 \bigskip
Start by creating a branch for your work (give it a descriptive name) and \emph{Question:} What does the commit graph of your repository look
switch to it. like? Can you draw it on paper?
\begin{itemize}
\item \emph{Question:} What branches are there now and what are the commits
they point to?
\end{itemize}
\bigskip \bigskip
Implement your feature (e.g. write documentation) and commit your changes. \emph{Hint:} Use \texttt{git log} with the appropriate arguments.
\begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look
like now?
\end{itemize}
\bigskip \bigskip
\subsubsection*{Merge your feature.} As an alternative to \texttt{git log}, you can also try a graphical viewer
Of course we want this nice feature in our \texttt{master} branch. such as \texttt{gitg} (installed on the course laptops) or \texttt{gitk}.
\bigskip \bigskip
\begin{itemize} \subsubsection*{Fast-forward merging.}
\item \emph{Question:} If you want to merge branch \texttt{B} into branch Of course we want the nice commit your neighbour just made in our
\texttt{A}, what should be your current branch? \texttt{master} branch.
\end{itemize}
\bigskip \bigskip
Merge your feature branch into \texttt{master}. Merge the remote \texttt{master} branch into \texttt{master}.
\begin{itemize} \begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look \item \emph{Question:} What does the commit graph of you repository look
...@@ -76,13 +64,8 @@ Merge your feature branch into \texttt{master}. ...@@ -76,13 +64,8 @@ Merge your feature branch into \texttt{master}.
\bigskip \bigskip
Since you merged it, you can now delete the feature branch.
\bigskip
\subsubsection*{A three-way merge.} \subsubsection*{A three-way merge.}
Unless you were extremely zealous, the last section produced a fast-forward The previous section produced a fast-forward merge.
merge.
\bigskip \bigskip
...@@ -92,12 +75,20 @@ merge. ...@@ -92,12 +75,20 @@ merge.
\bigskip \bigskip
Manipulate your repository in such a way that the commit graph contains a Together with your neighbour, manipulate your repository in such a way that
merge commit (created by a three-way merge). the commit graph contains a merge commit (created by a three-way merge).
\begin{itemize} \begin{itemize}
\item \emph{Question:} What does the commit graph of you repository look \item \emph{Question:} What does the commit graph of you repository look
like now? like now?
\end{itemize} \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} \end{document}
...@@ -20,10 +20,6 @@ Please take the following into account with respect to our GitLab server: ...@@ -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 \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 for you and select {\em Standard} instead of {\em LDAP} on the login
page. 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 \item Our GitLab server is very similar (in fact, it is a clone) to the
popular online GitHub (\texttt{https://github.com}) and Bitbucket popular online GitHub (\texttt{https://github.com}) and Bitbucket
(\texttt{https://bitbucket.org}) services. (\texttt{https://bitbucket.org}) services.
...@@ -32,11 +28,17 @@ Please take the following into account with respect to our GitLab server: ...@@ -32,11 +28,17 @@ Please take the following into account with respect to our GitLab server:
\bigskip \bigskip
\subsubsection*{Add your repository to GitLab.} \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. Now you have a nice repository, of course you want to share it on GitLab.
\bigskip \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} \begin{itemize}
\item \emph{Question:} What is the repository URL for your new project? \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. ...@@ -48,7 +50,7 @@ Add the GitLab repository as a remote to your local repository.
\bigskip \bigskip
Push your branch(es) to GitLab. Push your commits to GitLab.
\begin{itemize} \begin{itemize}
\item \emph{Question:} Can you see your repository content in the GitLab web \item \emph{Question:} Can you see your repository content in the GitLab web
...@@ -57,54 +59,25 @@ Push your branch(es) to GitLab. ...@@ -57,54 +59,25 @@ Push your branch(es) to GitLab.
\bigskip \bigskip
\subsubsection*{Clone an existing repository from GitLab.} \emph{Hint:} Use \texttt{git push} once with the \texttt{-u} flag so you can
There already are some nice repositories on GitLab! Pick one (e.g., from the use the \texttt{git push/pull} shortcuts.
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.
\bigskip \bigskip
Find an interesting project and click the \emph{Fork} button. This makes a \subsubsection*{More synchronisation.}
copy of the project under your own user, on GitLab. Look for a way to edit a file directly from the GitLab web interface (in your
browser) and do this at least once.
\bigskip \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 \bigskip
Create a new branch and implement some feature in it. Make sure to commit Now make another commit locally and push it to the GitLab server. Verify that
this. all these changes are now present both on your local machine and on the GitLab
server.
\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
\emph{Hint:} You can also start a discussion or do some code review inside the
merge request.
\end{document} \end{document}
Supports Markdown
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