diff --git a/basics/basics_handouts.tex b/basics/basics_handouts.tex index be15cdcc92c809d55d9a8fd608c33ccc0cb8128d..5b43970cc3aa7bcb7e9b565d356165d1701f3289 100644 --- a/basics/basics_handouts.tex +++ b/basics/basics_handouts.tex @@ -1,20 +1,15 @@ \documentclass{article} -\usepackage{fullpage} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Git Basics} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Git Basics practical. -\end{center} -\bigskip +\begin{document} +\makeHeader -\subsubsection*{Create a repository.} -First, create an empty directory and use ``\texttt{git init}'' to make a new +\subsubsection*{Create a repository} +First, create an empty directory and use ``\lstinline{git init}'' to make a new repository. \begin{itemize} \item \emph{Hint:} Use a unique name for the directory, different from your @@ -27,15 +22,15 @@ repository. Check the status of your files. \bigskip -\subsubsection*{Your first commit.} +\subsubsection*{Your first commit} Create a new file named ``README'' (with an editor, or by using the -``\texttt{touch}'' command). +``\lstinline{touch}'' command). \begin{itemize} \item \emph{Question:} What is the status of this new file? \end{itemize} \bigskip -Stage this file for the next commit using ``\texttt{git add}''. +Stage this file for the next commit using ``\lstinline{git add}''. \begin{itemize} \item \emph{Question:} What is the status of this file now? \end{itemize} @@ -47,20 +42,20 @@ Commit your changes. \end{itemize} \bigskip -\subsubsection*{Manipulation in the staging area.} +\subsubsection*{Manipulation in the staging area} Edit your file and stage it. \bigskip Now remove the file from the staging area. \bigskip -\subsubsection*{Working with versions.} +\subsubsection*{Working with versions} Commit your changed file. \bigskip Now you change your mind, and want to revert this commit. \begin{itemize} - \item \emph{Hint:} Use ``\texttt{git log}'' to see a list of all your + \item \emph{Hint:} Use ``\lstinline{git log}'' to see a list of all your versions. \end{itemize} \bigskip @@ -72,4 +67,5 @@ Edit your file again and check the differences with your last commit. \bigskip Make a file that you do not want to track. + \end{document} diff --git a/basics/handouts.sty b/basics/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/basics/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/branching/branching_handouts.tex b/branching/branching_handouts.tex index 8dfaedf9f8f4be0535398b135dd9ec76348354e8..f6af506242f5239c102490335d1090d90f10bb36 100644 --- a/branching/branching_handouts.tex +++ b/branching/branching_handouts.tex @@ -1,19 +1,14 @@ \documentclass{article} -\usepackage{fullpage} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Working with branches in Git} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Working with branches in Git practical. -\end{center} -\bigskip +\begin{document} +\makeHeader -\subsubsection*{Inspect the commit graph.} +\subsubsection*{Inspect the commit graph} We'll work from the repository you created in the previous practical. \begin{itemize} @@ -22,18 +17,15 @@ We'll work from the repository you created in the previous practical. \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. - +\emph{Hint:} Use \lstinline{git log} with the appropriate arguments. \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}. - +As an alternative to \lstinline{git log}, you can also try a graphical viewer +such as \lstinline{gitg} (installed on the course laptops) or \lstinline{gitk}. \bigskip -\subsubsection*{Implement a feature in a new branch.} +\subsubsection*{Implement a feature in a new branch} Let's do some real work (e.g., add some documentation to the project). - \bigskip Start by creating a branch for your work (give it a descriptive name) and @@ -43,7 +35,6 @@ switch to it. \item \emph{Question:} What branches are there now and what are the commits they point to? \end{itemize} - \bigskip Implement your feature (e.g. write documentation) and commit your changes. @@ -52,44 +43,37 @@ Implement your feature (e.g. write documentation) and commit your changes. \item \emph{Question:} What does the commit graph of you repository look like now? \end{itemize} - \bigskip -\subsubsection*{Merge your feature.} -Of course we want this nice feature in our \texttt{master} branch. - +\subsubsection*{Merge your feature} +Of course we want this nice feature in our \lstinline{master} branch. \bigskip \begin{itemize} - \item \emph{Question:} If you want to merge branch \texttt{B} into branch - \texttt{A}, what should be your current branch? + \item \emph{Question:} If you want to merge branch \lstinline{B} into branch + \lstinline{A}, what should be your current branch? \end{itemize} - \bigskip -Merge your feature branch into \texttt{master}. +Merge your feature branch into \lstinline{master}. \begin{itemize} \item \emph{Question:} What does the commit graph of you repository look like now? \end{itemize} - \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 merge. - \bigskip \begin{itemize} \item \emph{Question:} Can you think of a way to get a three-way merge? \end{itemize} - \bigskip Manipulate your repository in such a way that the commit graph contains a diff --git a/branching/handouts.sty b/branching/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/branching/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/introduction/handouts.sty b/introduction/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/introduction/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/introduction/introduction_handouts.tex b/introduction/introduction_handouts.tex index 5406e6cc1c5158ddb75b5f2a61845a96448408f4..aac4ed7c19380c99ad355a660ef036973b2d6402 100644 --- a/introduction/introduction_handouts.tex +++ b/introduction/introduction_handouts.tex @@ -1,30 +1,24 @@ \documentclass{article} -\usepackage{fullpage} -\usepackage{listings} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Git Introduction} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Git Introduction practical. -\end{center} -\bigskip +\begin{document} +\makeHeader \subsubsection*{Local configuration} First, let Git know what your name and e-mail address is: \begin{lstlisting} - $ git config --global user.name "<Your Name>" - $ git config --global user.email "<name@lumc.nl>" + $ git config --global user.name "Your Name" + $ git config --global user.email "your@email.address" $ cat ~/.gitconfig \end{lstlisting} \bigskip -For the other practicals, it is convenient to have a \texttt{projects} folder -for your repositories: +For the other practicals, it is convenient to have a \lstinline{projects} +folder for your repositories: \begin{lstlisting} mkdir ~/projects cd ~/projects @@ -47,7 +41,7 @@ If not, make one: You can leave all fields blank. \bigskip -Open \texttt{https://git.lumc.nl} in your browser. +Open \url{https://git.lumc.nl} in your browser. \medskip In the authentication form, use your username and password. @@ -67,6 +61,6 @@ To be able to upload new versions, you need to add your ssh key. Click the Give your key a title (e.g., ``Course laptop''). \medskip -Copy your ssh key to the key field (see the \texttt{cat} command above). +Copy your ssh key to the key field (see the \lstinline{cat} command above). \end{document} diff --git a/merging/handouts.sty b/merging/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/merging/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/merging/merging_handouts.tex b/merging/merging_handouts.tex index 5a2df65f3cb85884237afec7081dcb1252b7f8f1..4a314d78b15425037b993ebbb1132bebd3635d6c 100644 --- a/merging/merging_handouts.tex +++ b/merging/merging_handouts.tex @@ -1,28 +1,21 @@ \documentclass{article} -\usepackage{fullpage} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Combining changes by merging} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Combining changes by merging practical. -\end{center} -\bigskip +\begin{document} +\makeHeader -\subsubsection*{Setting the stage.} +\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: @@ -30,49 +23,41 @@ After you and your neighbour both cloned eachother's repositories: \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}. + \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? - +\emph{Question:} What does the commit graph of your repository look like? Can +you draw it on paper? \bigskip -\emph{Hint:} Use \texttt{git log} with the appropriate arguments. - +\emph{Hint:} Use \lstinline{git log} with the appropriate arguments. \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}. - +As an alternative to \lstinline{git log}, you can also try a graphical viewer +such as \lstinline{gitg} (installed on the course laptops) or \lstinline{gitk}. \bigskip -\subsubsection*{Fast-forward merging.} +\subsubsection*{Fast-forward merging} Of course we want the nice commit your neighbour just made in our -\texttt{master} branch. - +\lstinline{master} branch. \bigskip -Merge the remote \texttt{master} branch into \texttt{master}. +Merge the remote \lstinline{master} branch into \lstinline{master}. \begin{itemize} \item \emph{Question:} What does the commit graph of you repository look like now? \end{itemize} - \bigskip -\subsubsection*{A three-way merge.} +\subsubsection*{A three-way merge} 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? \end{itemize} - \bigskip Together with your neighbour, manipulate your repository in such a way that @@ -82,13 +67,11 @@ the commit graph contains a merge commit (created by a three-way merge). \item \emph{Question:} What does the commit graph of you repository look like now? \end{itemize} - \bigskip -\subsubsection*{Resolving a merge conflict.} +\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} diff --git a/presentation b/presentation index 5dc55db7bd0e1be6f32c156c0dc3908a8e29e394..d197f21f0884f2f28f0e450d7ff47efd21741ea7 160000 --- a/presentation +++ b/presentation @@ -1 +1 @@ -Subproject commit 5dc55db7bd0e1be6f32c156c0dc3908a8e29e394 +Subproject commit d197f21f0884f2f28f0e450d7ff47efd21741ea7 diff --git a/remotes/handouts.sty b/remotes/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/remotes/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/remotes/remotes_handouts.tex b/remotes/remotes_handouts.tex index 6baac8235ed1f052154513826cb51c73a087d0cf..3008d540a04e136a9466bf7e102fd81a7806d7de 100644 --- a/remotes/remotes_handouts.tex +++ b/remotes/remotes_handouts.tex @@ -1,19 +1,14 @@ \documentclass{article} -\usepackage{fullpage} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Git and remote repositories} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Git and remote repositories practical. -\end{center} -\bigskip +\begin{document} +\makeHeader -\subsubsection*{Some notes about using GitLab.} +\subsubsection*{Some notes about using GitLab} Please take the following into account with respect to our GitLab server: \begin{itemize} \item You can login to GitLab using your LUMC account. @@ -21,33 +16,29 @@ Please take the following into account with respect to our GitLab server: for you and select {\em Standard} instead of {\em LDAP} on the login page. \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. + popular online GitHub (\url{https://github.com}) and Bitbucket + (\url{https://bitbucket.org}) services. \end{itemize} - \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. - \bigskip -Go to GitLab (\texttt{https://git.lumc.nl}) and create a new project (use the +Go to GitLab (\url{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? \end{itemize} - \bigskip Add the GitLab repository as a remote to your local repository. - \bigskip Push your commits to GitLab. @@ -56,28 +47,23 @@ Push your commits to GitLab. \item \emph{Question:} Can you see your repository content in the GitLab web interface? \end{itemize} - \bigskip -\emph{Hint:} Use \texttt{git push} once with the \texttt{-u} flag so you can -use the \texttt{git push/pull} shortcuts. - +\emph{Hint:} Use \lstinline{git push} once with the \lstinline{-u} flag so you +can use the \lstinline{git push} / \lstinline{git pull} shortcuts. \bigskip -\subsubsection*{More synchronisation.} +\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 Update your local copy of the file with the change you just made (by fetching and merging). - \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. - \end{document} diff --git a/shared/shared.tex b/shared/shared.tex index c43ae0323430fa2487a0d60a9b8b725e10ccd580..ac5c839fa0273faea14dba6f1a88867c8c7e2053 100644 --- a/shared/shared.tex +++ b/shared/shared.tex @@ -1,5 +1,5 @@ +\providecommand{\courseTitle}{Code and data management with Git} \providecommand{\myDate}{25-04-16} - \providecommand{\acknowledgements}{ Martijn Vermaat\\ Wibowo Arindrarto\\ diff --git a/skeleton/handouts.sty b/skeleton/handouts.sty new file mode 120000 index 0000000000000000000000000000000000000000..c02fbb36599966c6d001d6eae567a7a427dbd724 --- /dev/null +++ b/skeleton/handouts.sty @@ -0,0 +1 @@ +../presentation/handouts.sty \ No newline at end of file diff --git a/skeleton/skeleton_handouts.tex b/skeleton/skeleton_handouts.tex index e402b00dbe9d4e0d3f53235fea54fe8aa0795232..2dd4388829b3e04472ca1435bbcc737ee5edec42 100644 --- a/skeleton/skeleton_handouts.tex +++ b/skeleton/skeleton_handouts.tex @@ -1,20 +1,14 @@ \documentclass{article} -\usepackage{fullpage} -\usepackage{listings} -\frenchspacing -\setlength{\parindent}{0pt} -\pagestyle{empty} +\providecommand{\handoutsTitle}{Project skeleton} -\begin{document} -\begin{center} -{\bf Git Introduction Course} +\usepackage{handouts} +\input{../shared/shared} -Project skeleton practical. -\end{center} -\bigskip +\begin{document} +\makeHeader -\subsubsection*{Project skeleton.} +\subsubsection*{Project skeleton} Search for the ``Project skeleton''. \begin{itemize} \item \emph{Hint:} Click the ``Public area'' icon and use the search option. @@ -25,11 +19,11 @@ Follow the README to make your own analysis project. \bigskip Suppose you are going to do an RNASeq analysis. Retrieve the file -``\texttt{data.tgz}'' from the -wiki\footnote{https://humgenprojects.lumc.nl/trac/humgenprojects/wiki/git} and -populate your analysis project. +``\lstinline{data.tgz}'' from the +wiki\footnote{\url{https://humgenprojects.lumc.nl/trac/humgenprojects/wiki/git}} +and populate your analysis project. -\subsubsection*{Git annex.} +\subsubsection*{Git annex} Check whether Git annex is installed, and install it if this is not the case. \begin{lstlisting} $ git annex @@ -65,8 +59,8 @@ Now, we clone the project and let this repository know where the clone is. \end{lstlisting} \bigskip -With the ``\texttt{file}'' command you can now see that -``\texttt{bigdata.dat}'' is not present in this repository. +With the ``\lstinline{file}'' command you can now see that +``\lstinline{bigdata.dat}'' is not present in this repository. \begin{lstlisting} $ git pull $ git annex get bigfile.dat @@ -87,4 +81,5 @@ You can now remove the big data file from the original repository. \end{lstlisting} But you can not remove it from the clone. + \end{document}