summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2016-03-17 17:53:25 -0600
committerkballou <kballou@devnulllabs.io>2016-03-17 17:53:25 -0600
commit4d8c7c38524e380a8c521a8bf605357188bbc567 (patch)
treeb61ae801321e54e19fe5e6886e5a32ce3b515403
parent6c5f6fb871747080baf33a867da586c5c39e2a59 (diff)
downloadgit-in-reverse-4d8c7c38524e380a8c521a8bf605357188bbc567.tar.gz
git-in-reverse-4d8c7c38524e380a8c521a8bf605357188bbc567.tar.xz
Update slides
Add content for more basic commands, merging, rebasing, commit messages, commit frequency, etc.
-rw-r--r--src/code/4/37
-rw-r--r--src/code/4/413
-rw-r--r--src/code/gitlog4
-rw-r--r--src/git-in-reverse.tex369
-rw-r--r--src/images/xkcd_git_commit.pngbin0 -> 53731 bytes
-rw-r--r--src/references.bib18
6 files changed, 374 insertions, 37 deletions
diff --git a/src/code/4/3 b/src/code/4/3
new file mode 100644
index 0000000..00f9e6c
--- /dev/null
+++ b/src/code/4/3
@@ -0,0 +1,7 @@
+± git mv foo bar.txt
+On branch master
+Changes to be committed:
+ (use "git reset HEAD <file>..." to unstage)
+
+ renamed: foo -> bar.txt
+
diff --git a/src/code/4/4 b/src/code/4/4
new file mode 100644
index 0000000..d773ae7
--- /dev/null
+++ b/src/code/4/4
@@ -0,0 +1,13 @@
+± git rm bar.txt
+rm 'bar.txt'
+± git status
+On branch master
+Changes to be committed:
+ (use "git reset HEAD <file>..." to unstage)
+
+ deleted: bar.txt
+
+± git commit -m "remove bar.txt"
+[master 8cbc334] remove bar.txt
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ delete mode 100644 bar.txt
diff --git a/src/code/gitlog b/src/code/gitlog
new file mode 100644
index 0000000..54ccd7a
--- /dev/null
+++ b/src/code/gitlog
@@ -0,0 +1,4 @@
+± git log --oneline | head -3
+19d1c94 Remove unmerged files on :Gstatus U
+9315ec6 Document StageUndo key map (U) in :Gstatus
+9025078 Call git clean for U on untracked file
diff --git a/src/git-in-reverse.tex b/src/git-in-reverse.tex
index 90ed5a6..91a1249 100644
--- a/src/git-in-reverse.tex
+++ b/src/git-in-reverse.tex
@@ -13,6 +13,7 @@
\usetikzlibrary{trees, shapes.misc, arrows}
\usepackage{pgfkeys}
\usepackage{graphicx}
+\usepackage[normalem]{ulem}
\graphicspath{{./images/}}
\setbeamertemplate{headline}{}
@@ -474,7 +475,7 @@ What does Git store?
\begin{tikzpicture}
\node[text=solarizedBlue] (foo) at (10, -10) {foo};
\node[text=solarizedBlue] (hfoo) at (10, -8) {257cc564};
- \draw[-o] (hfoo) -- (foo);
+ \draw[-o,thick] (hfoo) -- (foo);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -486,8 +487,8 @@ What does Git store?
\node[text=solarizedBlue] (foo) at (10, -10) {foo};
\node[text=solarizedBlue] (hfoo) at (10, -8) {257cc564};
\node[text=solarizedMagenta] (tree1) at (9, -6) {fcf0be4d};
- \draw[-o] (hfoo) -- (foo);
- \draw[-o] (tree1) -- (hfoo);
+ \draw[-o,thick] (hfoo) -- (foo);
+ \draw[-o,thick] (tree1) -- (hfoo);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -500,9 +501,9 @@ What does Git store?
\node[text=solarizedBlue] (hfoo) at (10, -8) {257cc564};
\node[text=solarizedMagenta] (tree1) at (9, -6) {fcf0be4d};
\node[text=solarizedCyan] (commit1) at (5, -6) {a619a045a5};
- \draw[-o] (hfoo) -- (foo);
- \draw[-o] (tree1) -- (hfoo);
- \draw[-o] (commit1) -- (tree1);
+ \draw[-o,thick] (hfoo) -- (foo);
+ \draw[-o,thick] (tree1) -- (hfoo);
+ \draw[-o,thick] (commit1) -- (tree1);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -517,10 +518,10 @@ What does Git store?
\node[text=solarizedBlue] (hbar) at (8, -8) {5716ca59};
\node[text=solarizedMagenta] (tree1) at (9, -6) {fcf0be4d};
\node[text=solarizedCyan] (commit1) at (5, -6) {a619a045a5};
- \draw[-o] (hfoo) -- (foo);
- \draw[-o] (hbar) -- (bar);
- \draw[-o] (tree1) -- (hfoo);
- \draw[-o] (commit1) -- (tree1);
+ \draw[-o,thick] (hfoo) -- (foo);
+ \draw[-o,thick] (hbar) -- (bar);
+ \draw[-o,thick] (tree1) -- (hfoo);
+ \draw[-o,thick] (commit1) -- (tree1);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -536,12 +537,12 @@ What does Git store?
\node[text=solarizedMagenta] (tree2) at (9, -6) {b98c9a9f9};
\node[text=solarizedCyan] (commit2) at (5, -6) {2de9adf2b};
\node[text=solarizedCyan] (commit1) at (5, -8) {a619a045a5};
- \draw[-o] (hfoo) -- (foo);
- \draw[-o] (hbar) -- (bar);
- \draw[-o] (tree2) -- (hfoo);
- \draw[-o] (tree2) -- (hbar);
- \draw[-o] (commit2) -- (tree2);
- \draw[-o] (commit2) -- (commit1);
+ \draw[-o,thick] (hfoo) -- (foo);
+ \draw[-o,thick] (hbar) -- (bar);
+ \draw[-o,thick] (tree2) -- (hfoo);
+ \draw[-o,thick] (tree2) -- (hbar);
+ \draw[-o,thick] (commit2) -- (tree2);
+ \draw[-o,thick] (commit2) -- (commit1);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -558,13 +559,13 @@ What does Git store?
\node[text=solarizedCyan] (commit3) at (5, -6) {e0ea04248};
\node[text=solarizedCyan] (commit2) at (5, -8) {2de9adf2b};
\node[text=solarizedCyan] (commit1) at (5, -10) {a619a045a5};
- \draw[-o] (hfoo) -- (foo);
- \draw[-o] (hbar) -- (bar);
- \draw[-o] (tree2) -- (hfoo);
- \draw[-o] (tree2) -- (hbar);
- \draw[-o] (commit3) -- (tree3);
- \draw[-o] (commit3) -- (commit2);
- \draw[-o] (commit2) -- (commit1);
+ \draw[-o,thick] (hfoo) -- (foo);
+ \draw[-o,thick] (hbar) -- (bar);
+ \draw[-o,thick] (tree2) -- (hfoo);
+ \draw[-o,thick] (tree2) -- (hbar);
+ \draw[-o,thick] (commit3) -- (tree3);
+ \draw[-o,thick] (commit3) -- (commit2);
+ \draw[-o,thick] (commit2) -- (commit1);
\end{tikzpicture}
\end{figure}
\end{frame}
@@ -580,19 +581,9 @@ What does Git store?
\end{itemize}
\end{frame}
-\subsection{git-add}
-\begin{frame}
-\frametitle{\texttt{git-add}}
-Combines:
-\begin{itemize}
-\item<1->{\texttt{git-hash-object}}
-\item<2->{\texttt{git-update-index}}
-\end{itemize}
-\end{frame}
-
+\subsection{git-status}
\begin{frame}
\frametitle{\texttt{git-status}}
-\framesubtitle{Short aside about \texttt{git-status}}
\begin{itemize}
\item{The go-to command for peering into the current state of a repository}
\item{Provides information about state of all files}
@@ -604,6 +595,16 @@ Combines:
\end{itemize}
\end{frame}
+\subsection{git-add}
+\begin{frame}
+\frametitle{\texttt{git-add}}
+Combines:
+\begin{itemize}
+\item<1->{\texttt{git-hash-object}}
+\item<2->{\texttt{git-update-index}}
+\end{itemize}
+\end{frame}
+
\begin{frame}[fragile]
\frametitle{\texttt{git-add}}
\lstinputlisting[language=bash,numbers=none]{code/4/1}
@@ -613,7 +614,7 @@ Combines:
\begin{frame}
\frametitle{\texttt{git-commit}}
\begin{itemize}
-\item{Creates ``commit'' out of current staging area}
+\item{Creates a ``commit'' out of the current staging area}
\begin{itemize}
\item{Requires a short message}
\item{Will implicitly figure out the parent commit}
@@ -627,6 +628,46 @@ Combines:
\lstinputlisting[language=bash,numbers=none]{code/4/2}
\end{frame}
+\subsection{git-mv}
+\begin{frame}
+\frametitle{\texttt{git-mv}}
+\begin{itemize}
+\item{Combines:}
+\begin{itemize}
+\item{\texttt{mv}}
+\item{\texttt{git-add}}
+\end{itemize}
+\item{Rename detection is automatic}
+\end{itemize}
+\end{frame}
+
+\begin{frame}
+\frametitle{\texttt{git-mv}}
+\lstinputlisting[language=bash,numbers=none]{code/4/3}
+\end{frame}
+
+\subsection{git-rm}
+\begin{frame}
+\frametitle{\texttt{git-rm}}
+\begin{itemize}
+\item{Removes the file from working tree}
+\item{Stops tracking the file}
+\item{Adds the removal to the staging area}
+\end{itemize}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{\texttt{git-rm}}
+\lstinputlisting[language=bash,numbers=none]{code/4/4}
+\end{frame}
+
+\begin{frame}
+\frametitle{\texttt{git-rm}}
+\begin{itemize}
+\item{Can also use regular \texttt{rm} and \texttt{git-add}}
+\end{itemize}
+\end{frame}
+
\section{Advanced Git±}
\subsection{References}
\begin{frame}
@@ -677,6 +718,85 @@ Currently, all branches are pointing to the same commit:
\lstinputlisting[language=bash,numbers=none]{code/5/7}
\end{frame}
+\subsection{Merging}
+\begin{frame}
+\frametitle{Git± Merging}
+\begin{itemize}
+\item{Fast-Forward Merge}
+\item{$N$-parent Merge, where $N$ usually is $2$}
+\item{Both achieved via the \texttt{git-merge} command}
+\end{itemize}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Merging}
+\framesubtitle{Fast-Forward Merges}
+\begin{figure}
+\begin{tikzpicture}
+\node (C0) at (0, 4.5) {C0};
+\node (C1) at (0, 3) {C1};
+\node (C2) at (0, 1.5) {C2};
+\node (C3) at (1, 0) {C3};
+\node[text=solarizedCyan] (master) at (-3, 1.5) {master};
+\node[text=solarizedCyan] (develop) at (3, 0) {develop};
+
+\draw[-o,thick] (C0) -- (C1);
+\draw[-o,thick] (C1) -- (C2);
+\draw[-o,thick] (C2) to[out=-90,in=90] (C3);
+\draw[-o,thick] (master) -- (C2);
+\draw[-o,thick] (develop) -- (C3);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Merging}
+\framesubtitle{Fast-Forward Merges}
+\begin{figure}
+\begin{tikzpicture}
+\node (C0) at (0, 4.5) {C0};
+\node (C1) at (0, 3) {C1};
+\node (C2) at (0, 1.5) {C2};
+\node (C3) at (0, 0) {C3};
+\node[text=solarizedCyan] (master) at (-3, 0) {master};
+\node[text=solarizedCyan] (develop) at (3, 0) {develop};
+
+\draw[-o,thick] (C0) -- (C1);
+\draw[-o,thick] (C1) -- (C2);
+\draw[-o,thick] (C2) -- (C3);
+\draw[-o,thick] (master) -- (C3);
+\draw[-o,thick] (develop) -- (C3);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Merging}
+\framesubtitle{$2$-Parent Merge}
+\begin{figure}
+\begin{tikzpicture}
+\node (C0) at (0, 6.5) {C0};
+\node (C1) at (0, 5) {C1};
+\node (C2) at (0, 3) {C2};
+\node[text=solarizedMagenta] (C2') at (1, 3) {C2};
+\node[text=solarizedMagenta] (C3) at (1, 2) {C3};
+\node[text=solarizedOrange] (M1) at (0, 0) {M1};
+
+\coordinate (M) at (0, 0.5);
+
+\draw[-o,thick] (C0) -- (C1);
+\draw[-o,thick] (C1) -- (C2);
+\draw[-o,thick] (C1) to[in=90,out=-90] (C2');
+\draw[-o,thick] (C2') -- (C3);
+\draw[thick] (C2) -- (M);
+\draw[thick] (C3) to[in=90,out=-90] (M);
+\draw[-o,thick] (M) -- (M1);
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
\subsection{Synchronization}
\begin{frame}[fragile]
\frametitle{Working with remotes}
@@ -695,7 +815,7 @@ Example Usage:
\begin{itemize}
\item{\texttt{SSH://}: Bi-directional}
\item{\texttt{Git://}: Pull only, not authenticated}
-\item{\texttt{HTTP (S)://}: Bi-directional, authenticated, but stupid}
+\item{\texttt{HTTP (S)://}: Bi-directional, authenticated, unintelligent}
\item{\texttt{File://}: Strange}
\end{itemize}
\item{\texttt{git-push}: Push local changes to remote repository}
@@ -704,6 +824,168 @@ Example Usage:
\end{itemize}
\end{frame}
+\subsection{Rebase}
+\begin{frame}
+\frametitle{Git± Rebase}
+\framesubtitle{Another way to \sout{merge} rewrite history}
+Or, more realistically, a great way to have a bad time\ldots{}
+\begin{itemize}
+\item{Merges branches via a pop, play, replay strategy}
+\begin{enumerate}
+\item{Find common ancestor}
+\item{Pop ``ours'' off the ancestor}
+\item{Play ``theirs'' onto ancestor}
+\item{Replay ``ours'' onto result}
+\end{enumerate}
+\item{Inherently changes the replayed commits}
+\item{If this sounds scary, it is}
+\end{itemize}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Rebase}
+\begin{figure}
+\begin{tikzpicture}
+\coordinate (root) at (0, -0.27);
+\node (C0) at (1, 0) {C0};
+\node (C1) at (3, 0) {C1};
+\node (C2) at (5, 0) {C2};
+
+\draw[-o,thick,dotted] (root) -- (C0);
+\draw[-o,thick] (C0) -- (C1);
+\draw[-o,thick] (C1) -- (C2);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Rebase}
+\begin{figure}
+\begin{tikzpicture}
+\coordinate (root) at (0, -0.27);
+\node (C0) at (1, 0) {C0};
+\node (C1) at (3, 0) {C1};
+\node (C2) at (5, 0) {C2};
+\node[text=solarizedMagenta] (U1) at (3.5, -1) {U1};
+\node[text=solarizedMagenta] (U2) at (5.5, -1) {U2};
+
+\draw[-o,thick,dotted] (root) -- (C0);
+\draw[-o,thick] (C0) -- (C1);
+\draw[-o,thick] (C0) to[out=0,in=180] (U1);
+\draw[-o,thick] (C1) -- (C2);
+\draw[-o,thick] (U1) -- (U2);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Rebase}
+\begin{figure}
+\begin{tikzpicture}
+\coordinate (root) at (0, -0.27);
+\node (C0) at (1, 0) {C0};
+\node (C1) at (3, 2) {C1};
+\node (C2) at (5, 2) {C2};
+\node[text=solarizedMagenta] (U1) at (3, 0) {U1};
+\node[text=solarizedMagenta] (U2) at (5, 0) {U2};
+
+\draw[-o,thick,dotted] (root) -- (C0);
+\draw[-o,thick] (C0) -- (U1);
+\draw[-o,thick] (C1) -- (C2);
+\draw[-o,thick] (U1) -- (U2);
+\draw[-o,thick,dotted] (C0) to[out=0,in=180] (C1);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Rebase}
+\begin{figure}
+\begin{tikzpicture}
+\coordinate (root) at (0, -0.27);
+\node (C0) at (1, 0) {C0};
+\node[text=solarizedOrange] (C1) at (7, 0) {C1'};
+\node[text=solarizedOrange] (C2) at (9, 0) {C2'};
+\node (U1) at (3, 0) {U1};
+\node (U2) at (5, 0) {U2};
+
+\draw[-o,thick,dotted] (root) -- (C0);
+\draw[-o,thick] (C0) -- (U1);
+\draw[-o,thick] (U1) -- (U2);
+\draw[-o,thick] (U2) -- (C1);
+\draw[-o,thick] (C1) -- (C2);
+
+\end{tikzpicture}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Git± Rebase}
+\begin{itemize}
+\item{When to rebase?}
+\begin{itemize}
+\item{Squashing Work in Progress (WIP) commits}
+\item{Rebase Private Trees}
+\item{Pulling upstream changes in before sharing a new branch}
+\item{Preference toward linear history}
+\end{itemize}
+\item{When \textbf{not} to rebase?}
+\begin{itemize}
+\item{Non-Private Tree}
+\item{Other people's commits}
+\item{Preference toward chronological history}
+\end{itemize}
+\end{itemize}
+\end{frame}
+
+\section{Notes and Tips}
+\subsection{Commit Frequency}
+\begin{frame}
+\frametitle{Commit Frequency}
+\framesubtitle{How often to create commits}
+\begin{itemize}
+\item{WIP commits}
+\item{Logical Changes}
+\begin{itemize}
+\item{Implemented a new feature}
+\item{Fixed a bug}
+\end{itemize}
+\end{itemize}
+\end{frame}
+
+\subsection{Commit Messages}
+\begin{frame}
+\frametitle{Writing Good Commit Messages}
+\begin{figure}
+\includegraphics[scale=0.45]{xkcd_git_commit.png}
+\caption{XKCD and Git Log\cite{website:xkcd_revision_history_comic}}
+\end{figure}
+\end{frame}
+
+\begin{frame}
+\frametitle{Writing Good Commit Messages}
+\begin{enumerate}
+\item{Separate subject from body with a blank line}
+\item{Limit the subject line to 50 characters}
+\item{Capitalize the subject line}
+\item{Do not end the subject line with a period}
+\item{Use the imperative voice in the subject line}
+\item{Wrap the body at 72 characters}
+\item{Use the body to explain what and why vs.\ how}
+\end{enumerate}
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{Writing Good Commit Messages}
+\framesubtitle{Why?}
+Because \texttt{git-log} output \textit{needs} to be beautiful:
+\lstinputlisting[numbers=none]{code/gitlog}
+\end{frame}
+
+\subsection{git-pull}
\begin{frame}[fragile]
\frametitle{\texttt{git-pull} considered harmful}
\begin{itemize}
@@ -713,12 +995,25 @@ Example Usage:
\texttt{git pull} unless you actually want to merge the remote branch.''}
\item{I personally prefer creating an alias for \texttt{git-remote}}
\end{itemize}
-\lstinputlisting[
+\lstinputlisting[%
language=bash,
numbers=none,
title=\texttt{\~{}/.gitconfig}]{code/5/9}
\end{frame}
+\subsection{Moving Forward}
+\begin{frame}
+\frametitle{Git± Moving Forward}
+\begin{itemize}
+\item<2->{Read the output}
+\item<3->{No, \textit{really}, Read the output!}
+\item<4->{\url{git-scm.com} and ``Pro Git''}
+\item<5->{\texttt{\#{}git} on Freenode}
+\item<6->{Git± man pages~\cite{website:git_man_pages}}
+\item<7->{Git± workflows~\cite{website:gitworkflows7}}
+\end{itemize}
+\end{frame}
+
\section*{References}
\begin{frame}[allowframebreaks]
\frametitle{References}
diff --git a/src/images/xkcd_git_commit.png b/src/images/xkcd_git_commit.png
new file mode 100644
index 0000000..09afce9
--- /dev/null
+++ b/src/images/xkcd_git_commit.png
Binary files differ
diff --git a/src/references.bib b/src/references.bib
index de25726..11294df 100644
--- a/src/references.bib
+++ b/src/references.bib
@@ -11,6 +11,10 @@
howpublished="\url{https://xkcd.com/1597}",
author="Randall Munroe"
}
+@misc{website:xkcd_revision_history_comic,
+ howpublished="\url{http://xkcd.com/1296/}",
+ author="Randall Munroe"
+}
@misc{website:wiki_zlib,
howpublished="\url{https://en.wikipedia.org/wiki/Zlib}"
}
@@ -24,3 +28,17 @@
@misc{website:gitworkflows7,
howpublished="\url{https://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html}"
}
+@misc{website:tbaggery_git_commit_messages,
+ howpublished="\url{http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html}",
+ author="Tim Pope"
+}
+@misc{website:cbeams_git_commit_messages,
+ howpublished="\url{http://chris.beams.io/posts/git-commit/}",
+ author="Chris Beams"
+}
+@misc{website:git_man_pages,
+ howpublished="\url{https://www.kernel.org/pub/software/scm/git/docs/}"
+}
+@misc{website:linus_on_rebase,
+ howpublished="\url{http://www.mail-archive.com/dri-devel@lists.sourceforge.net/msg39091.html}"
+}