Skip to content

Commit 5555432

Browse files
committed
Add illustrations to section pages
An illustration with the default repo (with a remote repository added) was added to each section page. The parts that are not the focus for the section are faded (e.g. for the Commits section, branches are faded). gitdags was modified to include a "fade" style and new commands `\gitbranchfade`, `\gitremotebranchfade` and `\gittagfade`.
1 parent d7afb2d commit 5555432

File tree

2 files changed

+106
-3
lines changed

2 files changed

+106
-3
lines changed

gitdags.sty

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@
184184
align = left,
185185
font = \ttfamily\tiny,
186186
},
187+
fade/.style={
188+
reset preaction,
189+
draw opacity = .25,
190+
fill opacity = .25,
191+
},
187192
}
188193

189194
% directed acyclic graph
@@ -205,6 +210,19 @@
205210
\draw[DAGrefedge] (#4) -- (\nodename@gitdags);
206211
}
207212

213+
\newcommand\gitbranchfade[4][]{%
214+
\renewcommand\nodename@gitdags{#1}%
215+
\if\relax\detokenize{#1}\relax% check for empty optional argument
216+
\renewcommand\nodename@gitdags{#2}%
217+
\fi
218+
\node[
219+
DAGref,
220+
fade,
221+
fill = yellow!30,
222+
] (\nodename@gitdags) [#3] {#2};
223+
\draw[DAGrefedge, fade] (#4) -- (\nodename@gitdags);
224+
}
225+
208226
% remote-branch reference
209227
\newcommand\gitremotebranch[4][]{%
210228
\renewcommand\nodename@gitdags{#1}%
@@ -218,6 +236,19 @@
218236
\draw[DAGrefedge] (#4) -- (\nodename@gitdags);
219237
}
220238

239+
\newcommand\gitremotebranchfade[4][]{%
240+
\renewcommand\nodename@gitdags{#1}%
241+
\if\relax\detokenize{#1}\relax% check for empty optional argument
242+
\renewcommand\nodename@gitdags{#2}%
243+
\fi
244+
\node[
245+
DAGref,
246+
fade,
247+
fill = solarized-blue!20,
248+
] (\nodename@gitdags) [#3] {#2};
249+
\draw[DAGrefedge, fade] (#4) -- (\nodename@gitdags);
250+
}
251+
221252
% tag reference
222253
\newcommand\gittag[4][]{%
223254
\renewcommand\nodename@gitdags{#1}%
@@ -231,6 +262,19 @@
231262
\draw[DAGrefedge] (#4) -- (\nodename@gitdags);
232263
}
233264

265+
\newcommand\gittagfade[4][]{%
266+
\renewcommand\nodename@gitdags{#1}%
267+
\if\relax\detokenize{#1}\relax% check for empty optional argument
268+
\renewcommand\nodename@gitdags{#2}%
269+
\fi
270+
\node[
271+
DAGref,
272+
fade,
273+
fill = solarized-magenta!20,
274+
] (\nodename@gitdags) [#3] {#2};
275+
\draw[DAGrefedge, fade] (#4) -- (\nodename@gitdags);
276+
}
277+
234278
% HEAD symbolic reference
235279
\newcommand\gitHEAD[2]{%
236280
\node[

understanding-git.tex

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,27 @@ \section{Introduction}
153153
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
154154
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
155155
\section{Commits}
156-
\frame{\sectionpage}
156+
\begin{frame}
157+
\sectionpage
158+
\begin{figure}
159+
\centering
160+
\begin{tikzpicture}
161+
\gitDAG{
162+
A -- B -- {
163+
D,
164+
C -- E
165+
}
166+
};
167+
\gitbranchfade{master}
168+
{above=of D} {D}
169+
\gitremotebranchfade{origin/master}
170+
{right=of master} {D}
171+
\gitbranchfade{topic}
172+
{above=of E} {E}
173+
\end{tikzpicture}
174+
\end{figure}
175+
\end{frame}
176+
157177
\subsection{Introduction}
158178

159179
\begin{frame}
@@ -559,7 +579,27 @@ \subsection{\gitcmd{revert}}
559579
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
560580
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
561581
\section{Branches}
562-
\frame{\sectionpage}
582+
\begin{frame}
583+
\sectionpage
584+
\begin{figure}
585+
\centering
586+
\begin{tikzpicture}
587+
\gitDAG{[nodes=unreachable]
588+
A -- B -- {
589+
D,
590+
C -- E
591+
}
592+
};
593+
\gitbranch{master}
594+
{above=of D} {D}
595+
\gitremotebranchfade{origin/master}
596+
{right=of master} {D}
597+
\gitbranch{topic}
598+
{above=of E} {E}
599+
\end{tikzpicture}
600+
\end{figure}
601+
\end{frame}
602+
563603
\subsection{Introduction}
564604

565605
\begin{frame}
@@ -1377,7 +1417,26 @@ \subsection{\gitcmd{merge}}
13771417
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13781418
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13791419
\section{Remote Repositories}
1380-
\frame{\sectionpage}
1420+
\begin{frame}
1421+
\sectionpage
1422+
\begin{figure}
1423+
\centering
1424+
\begin{tikzpicture}
1425+
\gitDAG{[nodes=unreachable]
1426+
A -- B -- {
1427+
D,
1428+
C -- E
1429+
}
1430+
};
1431+
\gitbranchfade{master}
1432+
{above=of D} {D}
1433+
\gitremotebranch{origin/master}
1434+
{right=of master} {D}
1435+
\gitbranchfade{topic}
1436+
{above=of E} {E}
1437+
\end{tikzpicture}
1438+
\end{figure}
1439+
\end{frame}
13811440
\subsection{Introduction}
13821441

13831442
\begin{frame}

0 commit comments

Comments
 (0)