Commit d00c9db7 authored by Mihai's avatar Mihai

Updated solutions in practical 2 and refined basics presentation

parent 1342d8b6
......@@ -147,10 +147,21 @@
\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}\\
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_00.pdf}\\
\end{center}
\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.75\textwidth]{images/file_status_cycles_01.pdf}\\
\end{center}
\end{pframe}
\subsection{Adding/staging files}
\begin{pframe}
To start tracking the file, we need to stage it first:
......@@ -174,6 +185,19 @@
Note also that the file is now in the \stagedfile{staging area}.
\end{pframe}
\begin{pframe}
To start tracking the file, we need to stage it first:
\vspace{-0.4cm}
\begin{framed}
\prompt\ \gitcmd\ \cmd{add}\ \cmdarg{README}\
\end{framed}
We can see that the state of the file has changed:
\begin{center}
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_add.pdf}\\
\end{center}
\end{pframe}
\subsection{Commit}
\begin{pframe}
\vspace{-0.4cm}
......@@ -199,6 +223,20 @@
\end{framed}
\end{pframe}
\begin{pframe}
\vspace{-0.4cm}
\begin{framed}
\prompt\ \gitcmd\ \cmd{commit}\ \cmdopt{-m} \cmdarg{"First commit"}\\
\cliout{[}\branch{master}\ \commit{5466170}\cliout{] First commit}\\
\cliout{1 file changed, 1 insertion(+)}\\
\cliout{create mode 100644 README}
\end{framed}
\begin{center}
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_commit.pdf}\\
\end{center}
\end{pframe}
\subsection{}
\begin{pframe}
\vspace{-0.5cm}
......@@ -222,6 +260,20 @@
\end{framed}
\end{pframe}
\begin{pframe}
\vspace{-0.5cm}
Let's update the file now:
\vspace{-0.4cm}
\begin{framed}
\prompt\ \cmd{echo}\ \cmdarg{"Second version."}\ \op{$>$}\ \cmdarg{README}
\end{framed}
\begin{center}
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_edit.pdf}\\
\end{center}
\end{pframe}
\subsection{Check the differences}
\begin{pframe}
\vspace{-0.4cm}
......@@ -297,6 +349,19 @@
\end{pframe}
\subsection{Unstage}
\begin{pframe}
% \vspace{-0.5cm}
\begin{framed}
\prompt\ \cmd{echo}\ \cmdarg{"Some mistake"} \op{$>>$}\ \cmdarg{README} \\
\prompt\ \gitcmd\ \cmd{add}\ \cmdarg{README} \\
\prompt\ \gitcmd\ \cmd{reset}\ \textcolor{head}{\lstinline{HEAD}} \cmdarg{README}
\end{framed}
\begin{center}
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_reset.pdf}\\
\end{center}
\end{pframe}
\subsection{Check commit history}
\begin{pframe}
% \vspace{-0.5cm}
......@@ -313,8 +378,7 @@
\end{framed}
\end{pframe}
\section{Restoring Previous Versions}
\subsection{Checkout}
\subsection{Restoring Previous Versions}
\begin{pframe}
One that is used quite commonly is to discard a \modifiedfile{working directory}\
file changes and \textbf{restore its latest repository state}:
......@@ -328,6 +392,13 @@
\begin{framed}
\prompt\ \gitcmd\ \cmd{checkout}\ \cmdopt{--}\ \cmdarg{.}
\end{framed}
\pause
\begin{center}
\includegraphics[width=0.75\textwidth]{images/file_status_cycles_checkout.pdf}\\
\end{center}
\end{pframe}
\begin{pframe}
To retrieve a file from a specific commit into the \stagedfile{staging area}:
\vspace{-0.4cm}
\begin{framed}
......@@ -335,11 +406,6 @@
\end{framed}
\end{pframe}
% \subsection{Revert}
% \begin{pframe}
%
% \end{pframe}
\section{Extras}
\subsection{Explicit not tracking}
......
......@@ -310,8 +310,8 @@ Next, you will make some file changes and manipulate the commit graph even furth
\begin{multicols}{6}
\begin{itemize}
\item 1.1 - d
\item 1.2 - c
\item 1.1 - c
\item 1.2 - f
\item 1.3 - c
\item 1.4 - d
\item 1.5 - d
......
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