From d2221286a077bf0b7e57af77b8db24ff3c40987b Mon Sep 17 00:00:00 2001 From: mlefter Date: Fri, 1 Sep 2017 16:28:21 +0200 Subject: [PATCH] Merging: commit graph. --- .../images/commit_graph/commit_graph_00.svg | 8295 +++++++++++++++++ merging/merging.tex | 81 +- 2 files changed, 8332 insertions(+), 44 deletions(-) create mode 100644 merging/images/commit_graph/commit_graph_00.svg diff --git a/merging/images/commit_graph/commit_graph_00.svg b/merging/images/commit_graph/commit_graph_00.svg new file mode 100644 index 0000000..71bee65 --- /dev/null +++ b/merging/images/commit_graph/commit_graph_00.svg @@ -0,0 +1,8295 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + Branch names:- are easier to remember than commits ids.- make it clear what commits are all about. + + + + Bringing together commitsfrom different branches. + + + + The commit graph can become non-linear. + + + + Committing moves the currentbranch to the new commit. + + + + + + + + + + + + + #! /bin/bashtool src target -ratio 100 1234 + + + + run_tool.sh + + + + + + + + + 00 + + + 00 + + + + + + + + + + + + + + + + + + + + + 1d438b8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 12f82a1 + + + + + + + + + + + + + + #! /bin/bashtool src target -ratio 100 1234 + + + + run_tool.sh + + + + + + + + 01 + + + + + + + + + + + + + + + + + + + + + 1d438b8 + Initialize VCS + + Commit the file + + Add script. + + Commit id + + Commit message + + + + + 02 + + + + + + + + + + + + + + + + + + + + + + + + + #! /bin/bashtool src target -ratio 100 -config settings.json 1234 + + + + + run_tool.sh + + + + + + + + + + + + + 1234 + + + + settings.json + + + + + + + + { "ratio": 100} + 04 + + Time + + Edit the existing file + + Create new file + + 1d438b8 + + + + + + + + + + + + + + + + + + + + + + Initialize VCS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2f5458a + + + + + + + + + + + + + + H + + + + H + + + + + + + 03 + + 2f5458a + + Make scriptconfigurable. + + + + + #! /bin/bashtool src target -config settings.json 1234 + + + + run_tool.sh + + + + + + + + + + + + 1234 + + + + settings.json + + + + + + + + { "ratio": 100} + + + + + + + + + + + + + + + + + + + + 1d438b8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Commit + + Commit id + + Commit message + + + + + + + + + + + + + + + + + + + + + + + + 1d438b8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 2f5458a + + + + + + + + + + + + + + + my_project + + + .VCS + + + + settings.sh + run_script.sh + + + + + + + + + + + + + + + + + + + + + + + + + + + + H + + + Repository + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 01 + + + 1d438b8 + + + + 2f5458a + + + + H + + + + Every commit has a parent. + + Parent of + + Committing creates a newcommit on top of current one. + + + 2f5458a + + + + + + 02 + + + 1d438b8 + + + + 2f5458a + + + + H + + + + + 2f5458a + + + + Master + + + A branch is a pointer to a commit. + + The default branch. + + + 03 + + + 1d438b8 + + + + 2f5458a + + + + HEAD + + + + + 2f5458a + + + + Master + + + + Points to the current branch (commit). + + 04 + + + 1d438b8 + + + + 2f5458a + + + + HEAD + + + + + 2f5458a + + + + Master + + + + + + + HEAD + + + 12f82a1 + + + Master + + + + + + + + + + + + HEAD moves with it. + + + + Committing moves the currentbranch to the new commit. + + 05 + + + 1d438b8 + + + + 2f5458a + + + + + 2f5458a + + + + + + + HEAD + + + 12f82a1 + + + Master + + + + HEAD moves with it. + + 06 + + + 1d438b8 + + + + 2f5458a + + + + + 2f5458a + + + + + + + HEAD + + + 12f82a1 + + + Master + + + + + 441aa8c + + + + + + 33215af + + + Some feature + + + Sameparent + + 07 + + + 1d438b8 + + + + 2f5458a + + + + + 2f5458a + + + + + + + HEAD + + + 12f82a1 + + + Master + + + + + 441aa8c + + + + + + 33215af + + + Some feature + + + 11a5645 + + + + + + 4564aaf + + + Another feature + + + + 08 + + + 1d438b8 + + + + 2f5458a + + + + + 2f5458a + + + + + + + HEAD + + + 12f82a1 + + + Master + + + + + 441aa8c + + + + + + 33215af + + + Some feature + + + 11a5645 + + + + + + 4564aaf + + + Another feature + + + + + + + a12a223 + + + diff --git a/merging/merging.tex b/merging/merging.tex index a54bfa3..9c1c091 100644 --- a/merging/merging.tex +++ b/merging/merging.tex @@ -2,7 +2,7 @@ \input{../shared/shared.tex} -\author{Martijn Vermaat} +\author{} \title{\courseTitle} \providecommand{\mySubTitle}{Combining changes by merging} \providecommand{\myConference}{\courseTitle} @@ -39,70 +39,63 @@ \section{The Git commit graph} \subsection{A linear history} \begin{pframe} - \includegraphics[width=10cm]{linear} - \smallskip + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_00.pdf} + \end{center} +\end{pframe} - \begin{itemize} - \item Every commit has a parent. - \item {\em Committing} creates a new commit on top of the current one. - \end{itemize} +\begin{pframe} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_01.pdf} + \end{center} \end{pframe} \subsection{The default \lstinline{master} branch} \begin{pframe} - \includegraphics[width=10cm]{master} - \smallskip + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_02.pdf} + \end{center} +\end{pframe} - \begin{itemize} - \item A {\em branch} is a pointer to a commit. - \item By default there is one branch: \lstinline{master}. - \item \lstinline{HEAD} is a special pointer, it points to the current - branch. - \end{itemize} +\subsection{The \lstinline{HEAD} pointer} +\begin{pframe} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_03.pdf} + \end{center} \end{pframe} -\subsection{Committing moves the current branch pointer} +\subsection{Committing} \begin{pframe} - \begin{itemize} - \item Committing moves the current branch to the new commit. - \item (Of course, \lstinline{HEAD} moves with it.) - \end{itemize} - \bigskip + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_04.pdf} + \end{center} +\end{pframe} - \includegraphics[width=10cm]{commit} +\begin{pframe} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_05.pdf} + \end{center} \end{pframe} \subsection{A non-linear history} \begin{pframe} - \includegraphics[width=10cm]{nonlinear} - \smallskip - - \begin{itemize} - \item The commit graph can become non-linear. - \item Usually by committing from the same commit twice. - \end{itemize} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_06.pdf} + \end{center} \end{pframe} \subsection{Use branches to keep track of different code paths} \begin{pframe} - \begin{itemize} - \item Branch names are easier to remember than commit hashes. - \item Branch names make it clear what commits are about. - \end{itemize} - \bigskip - - \includegraphics[width=6cm]{branches} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_07.pdf} + \end{center} \end{pframe} -\subsection{Different code paths may later join} +\subsection{Merging} \begin{pframe} - \begin{itemize} - \item Commits from different branches can be brought together. - \item We call this {\em merging}. - \end{itemize} - \bigskip - - \includegraphics[width=6cm]{merge} + \begin{center} + \includegraphics[width=\textwidth]{images/commit_graph/commit_graph_08.pdf} + \end{center} \end{pframe} \section{Inspecting the commit graph} -- GitLab