basics_handouts.tex 2.78 KB
 Jeroen F.J. Laros committed Oct 11, 2013 1 2 \documentclass{article}  Mihai committed Sep 05, 2017 3 4 \usepackage[hidelinks]{hyperref}  Jeroen F.J. Laros committed Apr 24, 2016 5 \providecommand{\handoutsTitle}{Git Basics}  Jeroen F.J. Laros committed Oct 11, 2013 6   Jeroen F.J. Laros committed Apr 24, 2016 7 8 \usepackage{handouts} \input{../shared/shared}  Jeroen F.J. Laros committed Oct 11, 2013 9   Jeroen F.J. Laros committed Apr 24, 2016 10 11 \begin{document} \makeHeader  Jeroen F.J. Laros committed Oct 11, 2013 12   Mihai committed Sep 05, 2017 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 \subsubsection*{Connect to the education server} Open \url{http://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html} in your browser. \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 Introduce the education server IP address \textbf{145.88.35.11} as destination. \medskip Make sure that the \textbf{port number} is set to \textbf{22} and that \textbf{SSH} is selected as \textbf{connection type} and press \textbf{Open}'' to start the connection. \medskip Press Yes'' if the security alert pops up. \medskip Introduce your provided \textbf{username} and press enter. \medskip Introduce your provided \textbf{password} and press enter. \medskip \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 "your@email.address" \$ cat ~/.gitconfig \end{lstlisting} \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 45 \subsubsection*{Create a repository}  Mihai committed Nov 21, 2017 46 First, create an empty directory inside your home directory and use \lstinline{git init}'' in that  bow committed Nov 17, 2017 47 newly-created directory to make a new repository.  Jeroen F.J. Laros committed Oct 11, 2013 48 \begin{itemize}  bow committed Nov 17, 2017 49  \item \emph{Hint:} Use a short and descriptive name for the directory.  Jeroen F.J. Laros committed Oct 11, 2013 50 51 52 53 54  \item \emph{Question:} How can you see that you are working in a Git repository? \end{itemize} \bigskip  Mihai committed Nov 21, 2017 55 Check the status of your repository.  Jeroen F.J. Laros committed Oct 11, 2013 56 57 \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 58 \subsubsection*{Your first commit}  Jeroen F.J. Laros committed Oct 11, 2013 59 Create a new file named README'' (with an editor, or by using the  Jeroen F.J. Laros committed Apr 24, 2016 60 \lstinline{touch}'' command).  Jeroen F.J. Laros committed Oct 11, 2013 61 62 63 64 65 \begin{itemize} \item \emph{Question:} What is the status of this new file? \end{itemize} \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 66 Stage this file for the next commit using \lstinline{git add}''.  Jeroen F.J. Laros committed Oct 11, 2013 67 68 69 70 71 72 73 74 75 76 77 \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 78 \subsubsection*{Manipulation in the staging area}  Jeroen F.J. Laros committed Oct 11, 2013 79 80 81 82 83 84 Edit your file and stage it. \bigskip Now remove the file from the staging area. \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 85 \subsubsection*{Working with versions}  Jeroen F.J. Laros committed Oct 11, 2013 86 87 88 89 90 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 91  \item \emph{Hint:} Use \lstinline{git log}'' to see a list of all your  Jeroen F.J. Laros committed Oct 11, 2013 92 93 94 95 96 97 98 99 100 101 102  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 103   Jeroen F.J. Laros committed Oct 11, 2013 104 \end{document}