Commit 40f9a83b authored by Martijn Vermaat's avatar Martijn Vermaat

Incomplete slides on branching

parent b1a25654
......@@ -30,11 +30,109 @@
\bodytemplate
% First page of the presentation.
\section{Introduction}
\section{The Git commit graph}
\begin{frame}
\frametitle{}
\frametitle{A linear history}
\includegraphics[width=10cm]{images/linear}
\begin{itemize}
\item Every commit has a parent
\item {\em Committing} creates a new commit on top of the current one
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{The default \bt{master} branch}
\includegraphics[width=10cm]{images/master}
\begin{itemize}
\item A {\em branch} is a pointer to a commit
\item By default there is one branch: \bt{master}
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{The current commit: \bt{HEAD}}
\begin{itemize}
\item The current commit is called \bt{HEAD} (shown in blue)
\item \bt{HEAD} normally points to the current branch
\item Or to a commit if there is no current branch
\end{itemize}
\vspace{1cm}
\includegraphics[width=10cm]{images/head}
\end{frame}
\begin{frame}
\frametitle{Committing moves \bt{HEAD} and the current branch}
\begin{itemize}
\item Committing moves the current branch to the new commit
\item Of course, \bt{HEAD} moves with it
\item If there is no current branch, only \bt{HEAD} moves
\end{itemize}
\vspace{1cm}
\includegraphics[width=10cm]{images/commit}
\end{frame}
\begin{frame}
\frametitle{A non-linear history}
\includegraphics[width=10cm]{images/nonlinear}
\begin{itemize}
\item The commit graph can become non-linear
\item Usually by committing from the same commit twice
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Use branches to keep track of different code paths}
\begin{itemize}
\item Branch names are easier to remember than commit hashes
\item Branch names make it clear what commits are about
\end{itemize}
\vspace{0.5cm}
\includegraphics[width=6cm]{images/branches}
\end{frame}
\begin{frame}
\frametitle{Different code paths may later join}
\begin{itemize}
\item Commits from different branches can be brought together
\item We call this {\em merging}
\end{itemize}
\vspace{0.5cm}
\includegraphics[width=6cm]{images/merge}
\end{frame}
\section{Managing branches}
% todo: listing branches, showing current branch
\begin{frame}[fragile]
\frametitle{Switching to another branch: \bt{git checkout}}
\begin{lstlisting}[language=none]
git checkout mybranch
\end{lstlisting}
\begin{itemize}
\item Makes \bt{mybranch} the current branch (and moves \bt{HEAD})
\end{itemize}
\vspace{0.5cm}
\includegraphics[width=10cm]{images/checkout}
\end{frame}
\begin{frame}[fragile]
\frametitle{Creating a new branch: \bt{git branch}}
\begin{lstlisting}[language=none]
git branch mybranch
\end{lstlisting}
\begin{itemize}
\item Creates branch \bt{mybranch} at \bt{HEAD}
\item But doesn't switch to it! (use \bt{git checkout})
\end{itemize}
\vspace{0.5cm}
\includegraphics[width=10cm]{images/branch}
\end{frame}
% todo: merging branches, tags
\section{Questions?}
\lastpagetemplate
\begin{frame}
......@@ -47,6 +145,8 @@
Zuotian Tatum
% https://www.atlassian.com/git
\end{center}
\end{frame}
......
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.
This source diff could not be displayed because it is too large. You can view the blob instead.
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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment