basics_handouts.tex 1.75 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
\documentclass{article}
\usepackage{fullpage}

\frenchspacing
\setlength{\parindent}{0pt}
\pagestyle{empty}

\begin{document}
\begin{center}
{\bf Git Introduction Course}

Git Basics practical.
\end{center}
\bigskip

\subsubsection*{Create a repository.}
First, create an empty directory and use ``\texttt{git init}'' to make a new
repository.
\begin{itemize}
Martijn Vermaat's avatar
Martijn Vermaat committed
20 21
  \item \emph{Hint:} Use a unique name for the directory, different from your
    neighbour (this is convenient later).
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
  \item \emph{Question:} How can you see that you are working in a Git
    repository?
\end{itemize}
\bigskip

Check the status of your files.
\bigskip

\subsubsection*{Your first commit.}
Create a new file named ``README'' (with an editor, or by using the
``\texttt{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}''.
\begin{itemize}
  \item \emph{Question:} What is the status of this file now?
\end{itemize}
\bigskip

Commit your changes.
\begin{itemize}
  \item \emph{Question:} What happened to the status?
\end{itemize}
\bigskip

\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.}
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
    versions.
\end{itemize}
\bigskip

Edit your file again and check the differences with your last commit.
\begin{itemize}
  \item \emph{Question:} What is the difference with your first commit?
\end{itemize}
\bigskip

Make a file that you do not want to track.
\end{document}