Commit 1342d8b6 authored by Mihai's avatar Mihai

Extended basics practical + extraas

parent 0f3fd2ab
......@@ -111,7 +111,7 @@
\end{pframe}
\section{Git Operations}
\subsection{Checking the status of your files}
\subsection{Checking repository state}
\begin{pframe}
\begin{framed}
\prompt\ \gitcmd\ \cmd{status}\\
......@@ -119,17 +119,6 @@
\end{framed}
\end{pframe}
\begin{pframe}
Git itself will associate your files with various \textbf{states}
\footnote[1]{\scriptsize{Adapted from the
\href{http://git-scm.com/book/en/v2/Getting-Started-Git-Basics}
{Pro Git Book}.}}:
\begin{center}
\includegraphics[width=0.85\textwidth]{images/file_status_cycles.pdf}\\
\end{center}
\end{pframe}
\subsection{Checking the status of your files}
\begin{pframe}
\begin{framed}
\prompt\ \cmd{echo}\ \cmdarg{"First version."}\ \op{$>$}\ \cmdarg{README}
......@@ -151,6 +140,16 @@
\end{framed}
\end{pframe}
\subsection{Git file states}
\begin{pframe}
Git itself will associate your files with various \textbf{states}
\footnote[1]{\scriptsize{Adapted from the
\href{http://git-scm.com/book/en/v2/Getting-Started-Git-Basics}
{Pro Git Book}.}}:
\begin{center}
\includegraphics[width=0.85\textwidth]{images/file_status_cycles.pdf}\\
\end{center}
\end{pframe}
\subsection{Adding/staging files}
\begin{pframe}
......
......@@ -4,16 +4,23 @@
\providecommand{\handoutsTitle}{Git Basics}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{handouts}
\input{../shared/shared}
\begin{document}
\makeHeader
\subsubsection*{Connect to the education server}
Open \url{http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html} in your browser.
\medskip
\medskip
Download and run \href{https://the.earth.li/~sgtatham/putty/latest/w32/putty.exe}{\textbf{putty.exe}. (Alternative binary files, the SSH and Telnet client itself)}.
\medskip
......@@ -33,6 +40,76 @@ Introduce your provided \textbf{username} and press enter.
Introduce your provided \textbf{password} and press enter.
\medskip
\section{General questions}
\begin{enumerate}
\item How can you check your local git repository state?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git state
\item git repository
\item git commit
\item git status
\item git show
\item git log
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item What command is used to stage a file?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git stage
\item git checkout
\item git add
\item git status
\item git diff
\item git log
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item How do you tell git what files to ignore?
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item git ignore \{file-name\}
\item add the file paths to a file named ``.gitignore''
\item it is not possible
\item git not track \{file-name\}
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item The \gitcmd\ \cmd{commit}\ command:
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}[label=(\alph*)]
\item stages all the modified files
\item saves the staged files changes into the repository ``database''
\item retrieves old files into the working directory
\item shows a repository history and lets the user pick what commits to
discard
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item A file is brought into the modified state when:
\vspace{-0.2cm}
\begin{multicols}{2}
\begin{enumerate}
\item[[ ]] it is being staged
\item[[ ]] it is being edited by the user
\item[[ ]] the user checks out a previous version of it
\item[[ ]] the file is committed
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\end{enumerate}
\section{Practical exercises}
\subsubsection*{Local configuration}
First, let Git know what your name and e-mail address is:
\begin{lstlisting}
......
......@@ -3,32 +3,19 @@
\providecommand{\handoutsTitle}{\vspace{0.5cm}The git commit graph}
\usepackage{handouts}
\input{../shared/shared}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{graphicx}
\input{../shared/shared}
\begin{document}
\makeHeader
\section{General questions}
\begin{enumerate}
\item How do you check your local git repository state since your last commit?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git state
\item git repository
\item git commit
\item git status
\item git show
\item git log
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item A branch is:
\vspace{-0.2cm}
\begin{multicols}{3}
......@@ -43,6 +30,20 @@
\end{multicols}
\vspace{-0.3cm}
\item How can you see the commit history in a tree alike manner?
\vspace{-0.2cm}
\begin{multicols}{3}
\begin{enumerate}[label=(\alph*)]
\item git state
\item git repository
\item git commit
\item git status --tree
\item git show tree
\item git log --graph
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item What command could be used in joining two or more development histories (branches) together?
\vspace{-0.2cm}
\begin{multicols}{3}
......@@ -70,7 +71,7 @@
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item Which of the following creates a new branch called \colorbox{gray!20}{brand\_new} and also checks it out?
\vspace{-0.2cm}
\begin{multicols}{3}
......@@ -84,7 +85,7 @@
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item In order to merge a branch do we have to add and commit, or discard any changes first?
\vspace{-0.2cm}
\begin{multicols}{2}
......@@ -94,7 +95,7 @@
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item If we want to merge \colorbox{gray!20}{brand\_new} into \colorbox{gray!20}{master}, which branch should be checked out when we run the command \colorbox{gray!20}{git merge brand\_new}?
\vspace{-0.2cm}
\begin{multicols}{2}
......@@ -106,7 +107,7 @@
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\item Which of the following commands will delete the branch \colorbox{gray!20}{brand\_new}?
\vspace{-0.2cm}
\begin{multicols}{2}
......@@ -130,7 +131,7 @@
\end{enumerate}
\end{multicols}
\vspace{-0.3cm}
\end{enumerate}
\section{Inspecting the commit graph}
......@@ -169,7 +170,7 @@ Please navigate to that directory and try to use the commands presented during t
\item master
\end{enumerate}
\end{multicols}
\item The commit graph looks like:
\vspace{-0.2cm}
\begin{center}
......@@ -186,7 +187,7 @@ Please navigate to that directory and try to use the commands presented during t
\item advanced
\end{enumerate}
\end{multicols}
\item Merge branch \colorbox{gray!20}{documentation} into \colorbox{gray!20}{master}.
\item What merge type is performed if branch \colorbox{gray!20}{data} is merged into \colorbox{gray!20}{master}?
......@@ -201,7 +202,7 @@ Please navigate to that directory and try to use the commands presented during t
\end{multicols}
\item Merge branch \colorbox{gray!20}{data} into \colorbox{gray!20}{master}.
\end{enumerate}
......@@ -215,20 +216,20 @@ Next, you will make some file changes and manipulate the commit graph even furth
\begin{enumerate}
\item Checkout branch \colorbox{gray!20}{data} and create a new branch called \colorbox{gray!20}{data-europe}.
\vspace{-0.2cm}
\item Checkout branch \colorbox{gray!20}{data-europe}.
\vspace{-0.1cm}
\item Edit the \colorbox{gray!20}{data/capitals.txt} file by adding at the end of it Rome as Italy's capital (``Italy:Rome'').
Do not remove or make any changes to the information already present there.
\vspace{-0.1cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data} and merge the \colorbox{gray!20}{data-europe} branch into it.
\vspace{-0.1cm}
\item Why was the previous merge a fast-forward one?
\vspace{-0.3cm}
\begin{multicols}{2}
......@@ -239,7 +240,7 @@ Next, you will make some file changes and manipulate the commit graph even furth
\item none of the above
\end{enumerate}
\end{multicols}
\end{enumerate}
\subsection{Three-way merging without conflicts}
......@@ -247,24 +248,24 @@ Next, you will make some file changes and manipulate the commit graph even furth
\begin{enumerate}
\item Make sure branch \colorbox{gray!20}{data} is active (checkedout).
\vspace{-0.2cm}
\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.2cm}
\item Add Paris as capital of France at the end of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.2cm}
\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}
......@@ -272,27 +273,27 @@ Next, you will make some file changes and manipulate the commit graph even furth
\begin{enumerate}
\item Make sure branch \colorbox{gray!20}{data} is active (checkedout).
\vspace{-0.1cm}
\item Add Moscow as capital of Russia at the end of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.2cm}
\item Stage and commit the changes.
\vspace{-0.1cm}
\item Checkout branch \colorbox{gray!20}{data-europe}.
\vspace{-0.2cm}
\item Add Madrid as Spain's capital at the of the \colorbox{gray!20}{data/capitals.txt} file.
\vspace{-0.2cm}
\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}
......@@ -318,7 +319,7 @@ Next, you will make some file changes and manipulate the commit graph even furth
\item 1.7 - c
\item 1.8 - d
\item 1.9 - c
\item 2.1 - d
\item 2.1 - d
\item 2.2 - b
\item 2.3 - d
\item 2.4 - c
......
......@@ -3,6 +3,12 @@
\providecommand{\handoutsTitle}{Git and remote repositories}
\usepackage{handouts}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{xcolor}
\usepackage{graphicx}
\input{../shared/shared}
\begin{document}
......@@ -89,7 +95,7 @@ server.
\subsubsection*{Collaboration}
In this practical, you'll work with both your repository and 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}. Note that by now both repositories should have a
to your own repository from the previous practical as {\bf Y}. Note that by now both repositories should have a
corresponding GitLab project (a remote repository).
\bigskip
......
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