From 2af49b64a09cdbc4c7895b00acf9852a81b86c9d Mon Sep 17 00:00:00 2001 From: "J.F.J. Laros" <j.f.j.laros@lumc.nl> Date: Mon, 14 Oct 2013 00:04:20 +0200 Subject: [PATCH] Updated the basics slides. --- basics/basics.tex | 55 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/basics/basics.tex b/basics/basics.tex index 576e3de..bd39804 100644 --- a/basics/basics.tex +++ b/basics/basics.tex @@ -43,6 +43,7 @@ Initialized empty Git repository in <path>/.git/ \end{lstlisting} \bigskip + \pause Or you can ``clone'' an existing repository. \bigskip @@ -120,6 +121,7 @@ # README \end{lstlisting} \bigskip + \pause \begin{lstlisting}[language=none, caption=Now the file will be tracked.] $ git add README @@ -146,8 +148,14 @@ This will open an editor, give a short description of the changes you made. \begin{itemize} - \item This is useful when you want to search for older versions later. + \item Useful when you want to search. \end{itemize} + \bigskip + \pause + + \begin{lstlisting}[language=none, caption=Commit a new version.] + $ git commit -m "Solved the counting bug." + \end{lstlisting} \end{frame} \begin{frame}[fragile] @@ -164,6 +172,7 @@ # modified: README \end{lstlisting} \bigskip + \pause If you want to undo this, you can use ``\bt{git reset}''. \bigskip @@ -215,6 +224,11 @@ \bigskip The hash can be found with ``\bt{git log}''. + \bigskip + \pause + + You can also use an unique prefix of this hash, usually six characters is + enough. \end{frame} \begin{frame}[fragile] @@ -234,6 +248,15 @@ +Third version. \end{lstlisting} \bigskip + \pause + + For staged files, use the ``\bt{--cached}'' or ``\bt{--staged}'' option. + \bigskip + + \begin{lstlisting}[language=none, caption=Difference between the staging area + and the last commit.] + $ git diff --cached + \end{lstlisting} \end{frame} \begin{frame}[fragile] @@ -252,6 +275,12 @@ +Third version. \end{lstlisting} \bigskip + \pause + + \begin{lstlisting}[language=none, caption=Difference between two committed + versions.] + $ git diff 8e10be cc61ee + \end{lstlisting} \end{frame} \section{Extras} @@ -261,12 +290,14 @@ Sometimes you do not want to track certain files: \begin{itemize} \item Executables. - \item \bt{pdf} files (if you still have the \LaTeX source). + \item \bt{pdf} files (if you still have the \LaTeX\ source). \item Python bytecode (\bt{.pyc}) files. \item Files containing passwords. \end{itemize} \bigskip + \pause + Use the special ``\bt{.gitignore}'' file. \begin{lstlisting}[language=none, caption=Ignoring certain files.] $ touch notrack.txt $ echo notrack.txt > .gitignore @@ -277,6 +308,26 @@ \end{lstlisting} \end{frame} +\begin{frame}[fragile] + \frametitle{Help.} + + With the ``\bt{help}'' command get the manual of a particular subcommand. + \bigskip + + \begin{lstlisting}[language=none, caption=Get the full manual.] + $ git help <command> + \end{lstlisting} + \bigskip + \pause + + Example. + \bigskip + \begin{lstlisting}[language=none, caption=Get the manual for the diff + subcommand.] + $ git help diff + \end{lstlisting} +\end{frame} + \section{Questions?} \lastpagetemplate \begin{fframe} -- GitLab