basics_handouts.tex 1.69 KB
 Jeroen F.J. Laros committed Oct 11, 2013 1 2 \documentclass{article}  Jeroen F.J. Laros committed Apr 24, 2016 3 \providecommand{\handoutsTitle}{Git Basics}  Jeroen F.J. Laros committed Oct 11, 2013 4   Jeroen F.J. Laros committed Apr 24, 2016 5 6 \usepackage{handouts} \input{../shared/shared}  Jeroen F.J. Laros committed Oct 11, 2013 7   Jeroen F.J. Laros committed Apr 24, 2016 8 9 \begin{document} \makeHeader  Jeroen F.J. Laros committed Oct 11, 2013 10   Jeroen F.J. Laros committed Apr 24, 2016 11 12 \subsubsection*{Create a repository} First, create an empty directory and use \lstinline{git init}'' to make a new  Jeroen F.J. Laros committed Oct 11, 2013 13 14 repository. \begin{itemize}  Martijn Vermaat committed Dec 01, 2015 15 16  \item \emph{Hint:} Use a unique name for the directory, different from your neighbour (this is convenient later).  Jeroen F.J. Laros committed Oct 11, 2013 17 18 19 20 21 22 23 24  \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  Jeroen F.J. Laros committed Apr 24, 2016 25 \subsubsection*{Your first commit}  Jeroen F.J. Laros committed Oct 11, 2013 26 Create a new file named README'' (with an editor, or by using the  Jeroen F.J. Laros committed Apr 24, 2016 27 \lstinline{touch}'' command).  Jeroen F.J. Laros committed Oct 11, 2013 28 29 30 31 32 \begin{itemize} \item \emph{Question:} What is the status of this new file? \end{itemize} \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 33 Stage this file for the next commit using \lstinline{git add}''.  Jeroen F.J. Laros committed Oct 11, 2013 34 35 36 37 38 39 40 41 42 43 44 \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  Jeroen F.J. Laros committed Apr 24, 2016 45 \subsubsection*{Manipulation in the staging area}  Jeroen F.J. Laros committed Oct 11, 2013 46 47 48 49 50 51 Edit your file and stage it. \bigskip Now remove the file from the staging area. \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 52 \subsubsection*{Working with versions}  Jeroen F.J. Laros committed Oct 11, 2013 53 54 55 56 57 Commit your changed file. \bigskip Now you change your mind, and want to revert this commit. \begin{itemize}  Jeroen F.J. Laros committed Apr 24, 2016 58  \item \emph{Hint:} Use \lstinline{git log}'' to see a list of all your  Jeroen F.J. Laros committed Oct 11, 2013 59 60 61 62 63 64 65 66 67 68 69  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.  Jeroen F.J. Laros committed Apr 24, 2016 70   Jeroen F.J. Laros committed Oct 11, 2013 71 \end{document}