basics_handouts.tex 2.78 KB
Newer Older
1 2
\documentclass{article}

3 4
\usepackage[hidelinks]{hyperref}

5
\providecommand{\handoutsTitle}{Git Basics}
6

7 8
\usepackage{handouts}
\input{../shared/shared}
9

10 11
\begin{document}
\makeHeader
12

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

45
\subsubsection*{Create a repository}
46
First, create an empty directory inside your home directory and use ``\lstinline{git init}'' in that
47
newly-created directory to make a new repository.
48
\begin{itemize}
49
  \item \emph{Hint:} Use a short and descriptive name for the directory.
50 51 52 53 54
  \item \emph{Question:} How can you see that you are working in a Git
    repository?
\end{itemize}
\bigskip

55
Check the status of your repository.
56 57
\bigskip

58
\subsubsection*{Your first commit}
59
Create a new file named ``README'' (with an editor, or by using the
60
``\lstinline{touch}'' command).
61 62 63 64 65
\begin{itemize}
  \item \emph{Question:} What is the status of this new file?
\end{itemize}
\bigskip

66
Stage this file for the next commit using ``\lstinline{git add}''.
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

78
\subsubsection*{Manipulation in the staging area}
79 80 81 82 83 84
Edit your file and stage it.
\bigskip

Now remove the file from the staging area.
\bigskip

85
\subsubsection*{Working with versions}
86 87 88 89 90
Commit your changed file.
\bigskip

Now you change your mind, and want to revert this commit.
\begin{itemize}
91
  \item \emph{Hint:} Use ``\lstinline{git log}'' to see a list of all your
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.
103

104
\end{document}