Commit 44550afe authored by Laros's avatar Laros

New style presentation template.

parent fbb15197
\documentclass[slidestop]{beamer}
\author{Jeroen F.J. Laros}
\title{Git Basics}
\providecommand{\mySubTitle}{}
\providecommand{\myConference}{Git course}
\providecommand{\myDate}{Monday, June 23, 2014}
\author{Jeroen F. J. Laros}
\providecommand{\myGroup}{Leiden Genome Technology Center}
\providecommand{\myGroup}{}
\providecommand{\myDepartment}{Department of Human Genetics}
\providecommand{\myCenter}{Center for Human and Clinical Genetics}
\providecommand{\lastCenterLogo}{
\raisebox{-0.1cm}{
\includegraphics[height=1cm]{lgtc_logo}
%\includegraphics[height=0.7cm]{ngi_logo}
}
}
\providecommand{\lastRightLogo}{
%\includegraphics[height=0.7cm]{nbic_logo}
%\includegraphics[height=0.8cm]{nwo_logo_en}
%\hspace{1.5cm}\includegraphics[height=0.7cm]{gen2phen_logo}
}
\input{../shared/shared.tex}
\usetheme{lumc}
......@@ -26,102 +17,82 @@
% This disables the \pause command, handy in the editing phase.
%\renewcommand{\pause}{}
% Make the title page.
\bodytemplate
% Make the title slide.
\makeTitleSlide{\includegraphics[width=3.5cm]{git_logo}}
% First page of the presentation.
\section{Initialisation}
\begin{frame}[fragile]
\frametitle{Starting a project.}
\subsection{Starting a project}
\begin{pframe}
Creating a new repository is easy. You do not need a server, no registration,
etc.
\bigskip
\begin{lstlisting}[language=none, caption=Make a new repository.]
$ cd ~/projects
$ git init
Initialized empty Git repository in <path>/.git/
\end{lstlisting}
\bigskip
\pause
Or you can ``clone'' an existing repository.
\bigskip
\begin{lstlisting}[language=none, caption=Clone an existing repository.]
$ git clone <path-to-repository>
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Starting a project.}
\end{pframe}
\begin{pframe}
You can see a hidden directory in a Git repository.
\bigskip
\begin{lstlisting}[language=none, caption=A hidden directory is added.]
$ ls -a
. .. .git
\end{lstlisting}
\bigskip
This directory contains almost everything that Git stores and manipulates.
\end{frame}
\end{pframe}
\section{Manipulation}
\begin{frame}
\frametitle{Local operations.}
\subsection{Local operations}
\begin{pframe}
\begin{figure}[]
\begin{center}
\includegraphics[height=0.8\textheight]{pics/18333fig0106-tn}
\includegraphics[height=0.7\textheight]{18333fig0106-tn}
\end{center}
\caption{Working directory, staging area, and Git directory.}
\label{}
\end{figure}
\end{frame}
\begin{frame}[fragile]
\frametitle{Checking the status of your files.}
\end{pframe}
\subsection{Checking the status of your files}
\begin{pframe}
\begin{lstlisting}[language=none, caption=Check status.]
$ git status
nothing to commit (working directory clean)
\end{lstlisting}
\bigskip
``\bt{git status}'' can tell you whether your files are:
``\lstinline{git status}'' can tell you whether your files are:
\begin{itemize}
\item Untracked.
\item Unmodified.
\item Modified.
\item Staged.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Checking the status of your files.}
\end{pframe}
\begin{pframe}
\begin{figure}[]
\begin{center}
\includegraphics[height=0.8\textheight]{pics/18333fig0201-tn}
\includegraphics[height=0.7\textheight]{18333fig0201-tn}
\end{center}
\caption{The lifecycle of the status of your files.}
\label{}
\end{figure}
\end{frame}
\begin{frame}[fragile]
\frametitle{Adding, removing, renaming.}
\end{pframe}
\subsection{Adding, removing, renaming}
\begin{pframe}
\begin{lstlisting}[language=none, caption=This file is not tracked.]
$ echo First version. > README
$ git status
# Untracked files:
# README
\end{lstlisting}
\bigskip
\pause
\begin{lstlisting}[language=none, caption=Now the file will be tracked.]
......@@ -130,19 +101,16 @@
# Changes to be committed:
# new file: README
\end{lstlisting}
\bigskip
To rename a file, use ``\bt{git mv}'', to remove, use ``\bt{git rm}''.
\end{frame}
To rename a file, use ``\lstinline{git mv}'', to remove, use
``\lstinline{git rm}''.
\end{pframe}
\section{Working with versions}
\begin{frame}[fragile]
\frametitle{commit}
\subsection{commit}
\begin{pframe}
Once you have modified your files and added them to the \emph{staging area},
you can commit them (add them to the repository).
\bigskip
\begin{lstlisting}[language=none, caption=Commit a new version.]
$ git commit
\end{lstlisting}
......@@ -152,20 +120,16 @@
\begin{itemize}
\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]
\frametitle{Undoing changes.}
\end{pframe}
\subsection{Undoing changes}
\begin{pframe}
Sometimes you will accidentally add a file.
\bigskip
\begin{lstlisting}[language=none, caption=Adding a new version of a file.]
$ echo Second version. > README
$ git add README
......@@ -173,63 +137,50 @@
# Changes to be committed:
# modified: README
\end{lstlisting}
\bigskip
\pause
If you want to undo this, you can use ``\bt{git reset}''.
\bigskip
If you want to undo this, you can use ``\lstinline{git reset}''.
\begin{lstlisting}[language=none, caption=Unstage a file.]
$ git reset README
$ git status
# Changes not staged for commit:
# modified: README
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Undoing changes.}
\end{pframe}
Keep in mind that ``\bt{git reset}'' by default sets a staged file back to unstaged.
\begin{pframe}
Keep in mind that ``\lstinline{git reset}'' by default sets a staged file
back to unstaged.
\begin{lstlisting}[language=none, caption=Unstage a file.]
$ git reset README
$ git status
# Changes not staged for commit:
# modified: README
\end{lstlisting}
\bigskip
\pause
To discard all changes in an unstaged file, you can use ``\bt{git checkout}''
To discard all changes in an unstaged file, you can use
``\lstinline{git checkout}''
\begin{lstlisting}[language=none, caption=Discarding changes.]
$ git checkout -- .
$ git status
nothing to commit, working directory clean
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Undoing changes.}
\end{pframe}
\begin{pframe}
For now, let's commit our change and move on.
\bigskip
\begin{lstlisting}[language=none, caption=Adding a new version of a file.]
$ echo Second version. > README
$ git commit
$ git status
nothing to commit, working directory clean
\end{lstlisting}
\bigskip
\end{frame}
\begin{frame}[fragile]
\frametitle{Viewing the history.}
To see the history of your project, use ``\bt{git log}''.
\bigskip
\end{pframe}
\subsection{Viewing the history}
\begin{pframe}
To see the history of your project, use ``\lstinline{git log}''.
\begin{lstlisting}[language=none, caption=The log of our project.]
$ git log
commit cc61ee7cd72590f3bebcc9e1ff3e9435c7f7dd28
......@@ -244,36 +195,29 @@
First version.
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Undo a commit.}
\end{pframe}
\subsection{Undo a commit}
\begin{pframe}
Sometimes we want to undo an entire commit. This is done with
``\bt{git revert}''.
\bigskip
``\lstinline{git revert}''.
\begin{lstlisting}[language=none, caption=Revert a commit.]
$ git revert cc61ee7cd72590f3bebcc9e1ff3e9435c7f7dd28
$ git revert cc61ee7cd7
$ cat README
First version.
\end{lstlisting}
\bigskip
The hash can be found with ``\bt{git log}''.
The hash can be found with ``\lstinline{git log}''.
\bigskip
\pause
You can also use a unique prefix of this hash, usually six characters is
enough.
\end{frame}
\begin{frame}[fragile]
\frametitle{Viewing changes in detail.}
If you want to see what has changed, use ``\bt{git diff}''.
\bigskip
\end{pframe}
\subsection{Viewing changes in detail}
\begin{pframe}
If you want to see what has changed, use ``\lstinline{git diff}''.
\begin{lstlisting}[language=none, caption=Difference between the working copy
and the staging area.]
$ echo Third version. > README
......@@ -284,24 +228,18 @@
-First version.
+Third version.
\end{lstlisting}
\bigskip
\pause
For staged files, use the ``\bt{--cached}'' or ``\bt{--staged}'' option.
\bigskip
For staged files, use the ``\lstinline{--cached}'' or
``\lstinline{--staged}'' option.
\begin{lstlisting}[language=none, caption=Difference between the staging area
and the last commit.]
$ git diff --cached
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Viewing changes in detail.}
\end{pframe}
\begin{pframe}
You can see the differences between any two versions.
\bigskip
\begin{lstlisting}[language=none, caption=Difference between the working copy
and an other commit.]
$ git diff cc61ee
......@@ -311,30 +249,28 @@
-Second version.
+Third version.
\end{lstlisting}
\bigskip
\pause
\begin{lstlisting}[language=none, caption=Difference between two committed
versions.]
$ git diff 8e10be cc61ee
\end{lstlisting}
\end{frame}
\end{pframe}
\section{Extras}
\begin{frame}[fragile]
\frametitle{Explicit no tracking.}
\subsection{Explicit no tracking}
\begin{pframe}
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 Python bytecode (\bt{.pyc}) files.
\item PDF files (if you still have the \LaTeX\ source).
\item Python bytecode (\lstinline{.pyc}) files.
\item Files containing passwords.
\end{itemize}
\bigskip
\medskip
\pause
Use the special ``\bt{.gitignore}'' file.
Use the special ``\lstinline{.gitignore}'' file.
\begin{lstlisting}[language=none, caption=Ignoring certain files.]
$ touch notrack.txt
$ echo notrack.txt > .gitignore
......@@ -343,46 +279,35 @@
$ git status
nothing to commit, working directory clean
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{Help.}
With the ``\bt{help}'' command get the manual of a particular subcommand.
\bigskip
\end{pframe}
\subsection{Help}
\begin{pframe}
With the ``\lstinline{help}'' command get the manual of a particular
subcommand.
\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}
\begin{center}
Acknowledgements:
\bigskip
\bigskip
\end{pframe}
Martijn Vermaat
Zuotian Tatum
Wibowo Arindrarto
\makeAcknowledgementsSlide{
\begin{tabular}{l}
\acknowledgements
\end{tabular}
\bigskip
\end{center}
\hfill\includegraphics[width=3.5cm]{git_logo}
\vfill
\permfoot{http://git-scm.com/book}
\end{fframe}
\begin{tabular}{l}
\small\url{http://git-scm.com/book}\\
\end{tabular}
}
\end{document}
../presentation/gen2phen_logo.eps
\ No newline at end of file
../shared/git_logo.png
\ No newline at end of file
../presentation/lgtc_logo.eps
\ No newline at end of file
../presentation/logos/
\ No newline at end of file
../presentation/lumc_logo.eps
\ No newline at end of file
../presentation/lumc_logo_small.eps
\ No newline at end of file
../presentation/nbic_logo.eps
\ No newline at end of file
../presentation/ngi_logo.eps
\ No newline at end of file
../presentation/nwo_logo_en.eps
\ No newline at end of file
../pics/
\ No newline at end of file
../presentation/ul_logo.eps
\ No newline at end of file
This diff is collapsed.
../presentation/gen2phen_logo.eps
\ No newline at end of file
../shared/git_logo.png
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
../presentation/lgtc_logo.eps
\ No newline at end of file
../presentation/logos/
\ No newline at end of file
../presentation/lumc_logo.eps
\ No newline at end of file
../presentation/lumc_logo_small.eps
\ No newline at end of file
../presentation/nbic_logo.eps
\ No newline at end of file
../presentation/ngi_logo.eps
\ No newline at end of file
../presentation/nwo_logo_en.eps
\ No newline at end of file
../presentation/ul_logo.eps
\ No newline at end of file
../pics/src/18333fig0101-tn.png
\ No newline at end of file
../pics/src/18333fig0102-tn.png
\ No newline at end of file
../pics/src/18333fig0103-tn.png
\ No newline at end of file
../presentation/gen2phen_logo.eps
\ No newline at end of file
../shared/git_logo.png
\ No newline at end of file
\documentclass[slidestop]{beamer}
\author{Jeroen F. J. Laros}
\title{Introduction to Version Control}
\providecommand{\mySubTitle}{}
\providecommand{\myConference}{Git course}
\providecommand{\myDate}{Tuesday, December 1, 2015}
\author{Jeroen F. J. Laros}
\providecommand{\myGroup}{Leiden Genome Technology Center}
\providecommand{\myGroup}{}
\providecommand{\myDepartment}{Department of Human Genetics}
\providecommand{\myCenter}{Center for Human and Clinical Genetics}
\providecommand{\lastCenterLogo}{
\raisebox{-0.1cm}{
\includegraphics[height=1cm]{lgtc_logo}
%\includegraphics[height=0.7cm]{ngi_logo}
}
}
\providecommand{\lastRightLogo}{
%\includegraphics[height=0.7cm]{nbic_logo}
%\includegraphics[height=0.8cm]{nwo_logo_en}
%\hspace{1.5cm}\includegraphics[height=0.7cm]{gen2phen_logo}
}
\input{../shared/shared.tex}
\usetheme{lumc}
......@@ -27,7 +18,7 @@