Skip to content

Commit 5a26a57

Browse files
committed
Split up basic workshop into chapter files
1 parent b7ad6fe commit 5a26a57

File tree

7 files changed

+376
-415
lines changed

7 files changed

+376
-415
lines changed

chapters/branches.tex

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
\section{Branches}\label{sec:branches}
2+
3+
\begin{frame}[c]
4+
\slidehead
5+
\centering
6+
\begin{tikzpicture}
7+
% state 1
8+
\node<1->[commit](c0){c0c0c};
9+
\node<1->[commit, right=2em of c0](c1){c1c1c};
10+
\node<1-2>[branch, right=2em of c1](bm1){master};
11+
\draw<1->[parent] (c1) to (c0);
12+
\draw<1-2>[parent] (bm1) to (c1);
13+
% state 2
14+
\node<2-3>[branch, below=1em of bm1](fa1){feature};
15+
\draw<2-3>[parent] (fa1.west) to (c1.east);
16+
% state 3
17+
\node<3->[commit, right=2em of c1](c2){c2c2c};
18+
\node<3->[branch, right=2em of c2](bm2){master};
19+
\draw<3->[parent] (c2) to (c1);
20+
\draw<3->[parent] (bm2) to (c2);
21+
% state 4
22+
\node<4->[commit, below=1em of c2](c3){c3c3c};
23+
\node<4>[branch, right=2em of c3](fa2){feature};
24+
\node<4->[branch, right=2em of c2](bm3){master};
25+
\draw<4->[parent] (c3.west) to (c1.east);
26+
\draw<4->[parent] (fa2) to (c3);
27+
% state 5
28+
\node<5->[commit, right=2em of c3](c4){c4c4c};
29+
\node<5->[branch, right=2em of c4](fa3){feature};
30+
\draw<5->[parent] (fa3) to (c4);
31+
\end{tikzpicture}
32+
\vspace{1em}\par
33+
\begin{enumerate}
34+
\item<1->{\texttt{master}-Branch verweist auf Commit \texttt{c1c1c}}
35+
\item<2->{\texttt{feature}-Branch wird von \texttt{master}-Branch abgeleitet}
36+
\item<3->{neuer Commit \texttt{c2c2c} in \texttt{master}-Branch}
37+
\item<4->{neuer Commit \texttt{c3c3c} in \texttt{feature}-Branch}
38+
\item<5->{neuer Commit \texttt{c4c4c} in \texttt{feature}-Branch}
39+
\end{enumerate}
40+
\end{frame}

chapters/commits.tex

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
\section{Commits}\label{sec:commits}
2+
3+
\begin{frame}
4+
\slidehead
5+
\begin{itemize}
6+
\item Datei hinzugefügt, geändert, verschoben oder gelöscht
7+
\item mit Nachricht versehen
8+
\item \enquote{kryptische} Bezeichnung (Hash), z.B. \texttt{bc7f1a9e22bc7f19e22bc}\dots
9+
\begin{itemize}
10+
\item erste fünf Zeichen zur Identifizierung meist ausreichend
11+
\end{itemize}
12+
\end{itemize}
13+
\end{frame}
14+
15+
\begin{frame}
16+
\slidehead
17+
\vspace{-1em}
18+
\centering
19+
\includegraphics[scale=.3]{../pictures/structure-overview}
20+
\end{frame}
21+
22+
\begin{frame}
23+
\slidehead
24+
\vspace{1em}
25+
\centering
26+
\begin{tikzpicture}
27+
% state 1
28+
\node[commit](c1){c1c1c};
29+
\node<1>[head, below=2 em of c1](head0){};
30+
\draw<1>[parent] (head0) to (c1);
31+
% state 2
32+
\node<2->[commit, right=2 em of c1](c2){c2c2c};
33+
\draw<2->[parent] (c2) to (c1);
34+
\node<2>[head, below=2 em of c2](head1){};
35+
\draw<2>[parent] (head1) to (c2);
36+
% state 3
37+
\node<3->[commit, right=2 em of c2](c3){c3c3c};
38+
\draw<3->[parent] (c3) to (c2);
39+
\node<3>[head, below=2 em of c3](head2){};
40+
\draw<3>[parent] (head2) to (c3);
41+
% state 4
42+
\node<4->[branch, below=2em of c3](branch_master){master};
43+
\draw<4->[parent] (branch_master) to (c3);
44+
\node<4>[head, below=2em of branch_master](head2){};
45+
\draw<4>[parent] (head2) to (branch_master);
46+
% state 5
47+
\node<5->[head, below=2em of c2](head2){};
48+
\draw<5->[parent] (head2) to (c2);
49+
\end{tikzpicture}
50+
\vspace{1em}\par
51+
\only<1>{initialer Commit \texttt{c1c1c}, z.B. \texttt{"initial commit"}}
52+
\only<2>{Commit \texttt{c2c2c}, z.B. \texttt{"implement add and mul"}}
53+
\only<3>{Commit \texttt{c3c3c}, z.B. \texttt{"fix sum"}}
54+
\only<4>{\texttt{HEAD} zeigt \textit{indirekt} auf einen Commit (hier \texttt{c3c3c})}
55+
\only<5>{\texttt{HEAD} kann auch \textit{direkt} auf Commit (hier \texttt{c2c2c}) zeigen}
56+
\end{frame}

chapters/merging.tex

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
\section{Merging}\label{sec:merging}
2+
3+
\begin{frame}[c]
4+
\centering
5+
\Large
6+
\textbf{Wie gelangen die Commits von einen Branch in einen anderen?}
7+
\end{frame}
8+
9+
\subsection*{Fast-Forward Merge}
10+
11+
\begin{frame}[c]
12+
\slidehead
13+
\centering
14+
\begin{tikzpicture}
15+
% create c1
16+
\node<1->[commit](c1){c1c1c} node[left=1em of c1]{$\dots$};
17+
% create master
18+
\node<1-1>[branch, right=2em of c1](m1){master};
19+
\draw<1-1>[parent] (m1) to (c1);
20+
% create c2
21+
\node<1->[commit, below=1em of m1](c2){c2c2c};
22+
\draw<1->[parent] (c2.west) to (c1.east);
23+
% create c3
24+
\node<1->[commit, right=2em of c2](c3){c3c3c};
25+
\draw<1->[parent] (c3) to (c2);
26+
% create branch feature
27+
\node<1->[branch, right=2em of c3](fa1){feature};
28+
\draw<1->[parent] (fa1) to (c3);
29+
% 2 # create master
30+
\node<2->[branch, above=1em of fa1](m2){master};
31+
\draw<2->[parent] (m2.west) to (c3.east);
32+
\end{tikzpicture}
33+
\vspace{2em}
34+
\begin{itemize}
35+
\item \textbf{Fast-Forward Merge}
36+
\item möglich, wenn zu mergende Branches \textit{nicht} divergiert
37+
\item<2-> lässt \texttt{master}-Branch \textit{direkt} auf Commit von \texttt{feature}-Branch zeigen
38+
\item<2-> \textit{kein} Merge-Commit notwendig (gleich mehr)
39+
\item<3-> einfachster Fall, aber seltener
40+
\end{itemize}
41+
\end{frame}
42+
43+
\subsection*{Normalfall}
44+
45+
\begin{frame}
46+
\slidehead
47+
\centering
48+
\vspace{2em}\par
49+
\begin{tikzpicture}
50+
% create c1
51+
\node<1->[commit](c1){c1c1c} node[left=1em of c1]{$\dots$};
52+
% create c3
53+
\node<1->[commit, right=2em of c1](c3){c3c3c};
54+
\draw<1->[parent] (c3) to (c1);
55+
% create master 1
56+
\node<1>[branch, right=2em of c3](m1){master};
57+
\draw<1>[parent] (m1) to (c3);
58+
% create c2
59+
\node<1->[commit, below=1em of c3](c2){c2c2c};
60+
\draw<1->[parent] (c2.west) to (c1.east);
61+
% create c4
62+
\node<1->[commit, right=2em of c2](c4){c4c4c};
63+
\draw<1->[parent] (c4) to (c2);
64+
% create branch feature
65+
\node<1->[branch, right=2em of c4](fa1){feature};
66+
\draw<1->[parent] (fa1) to (c4);
67+
% create c5
68+
\node<2->[mergecommit, above=1em of fa1](c5){c5c5c};
69+
\draw<2->[parent] (c5) to (c3);
70+
\draw<2->[parent] (c5.west) to (c4.east);
71+
% create master 2
72+
\node<2->[branch, right=2em of c5](m){master};
73+
\draw<2->[parent] (m) to (c5);
74+
75+
\end{tikzpicture}
76+
\vspace{2em}
77+
\begin{itemize}
78+
\item \textbf{Normalfall}
79+
\item \texttt{master}-Branch und \texttt{feature}-Branch sind divergiert
80+
\item<2-> Commit \texttt{c5c5c} ist Merge-Commit aus \texttt{master}- und \texttt{feature}-Branch
81+
\end{itemize}
82+
\end{frame}
83+
84+
85+
\subsection*{Normalfall mit Squash}
86+
87+
\begin{frame}
88+
\slidehead
89+
\centering
90+
91+
\begin{tikzpicture}
92+
% create c1
93+
\node<1->[commit](c1){c1c1c} node[left=1em of c1]{$\dots$};
94+
% create c3
95+
\node<1->[commit, right=2em of c1](c3){c3c3c};
96+
\draw<1->[parent] (c3) to (c1);
97+
% create master 1
98+
\node<1>[branch, right=2em of c3](m1){master};
99+
\draw<1>[parent] (m1) to (c3);
100+
% create c2
101+
\node<1>[commit, below=2em of c3](c2){c2c2c};
102+
\draw<1>[parent] (c2.west) to (c1.east);
103+
% create c4
104+
\node<1>[commit, right=2em of c2](c4){c4c4c};
105+
\draw<1>[parent] (c4) to (c2);
106+
% create branch feature
107+
\node<1>[branch, right=2em of c4](fa1){feature};
108+
\draw<1>[parent] (fa1) to (c4);
109+
% 2 # create c5
110+
\node<2->[mergecommit, below right=1.5em and 2em of c1, minimum width=14em](c5){c5c5c};
111+
\draw<2->[parent] (c5.west) to (c1.east);
112+
% 2 # create c2
113+
\node<2->[commit, below right=5em and 2em of c1](c2){c2c2c};
114+
\draw<2->[parent] (c2.west) to (c1.east);
115+
% 2 # create c4
116+
\node<2->[commit, right=2em of c2](c4){c4c4c};
117+
\draw<2->[parent] (c4) to (c2);
118+
% 2 # create c6
119+
\node<2->[mergecommit, right=10em of c3](c6){c6c6c};
120+
\draw<2->[parent] (c6) to (c3);
121+
\draw<2->[parent] (c6.west) to (c5.east);
122+
% 2 # create branch feature
123+
\node<2->[branch, right=2em of c4](fa1){feature};
124+
\draw<2->[parent] (fa1) to (c4);
125+
% 2 # create branch master
126+
\node<2->[branch, right=2em of c6](m){master};
127+
\draw<2->[parent] (m) to (c6);
128+
% create meta
129+
% \draw<2->[parent, dotted] ([yshift=1.5em] c2.north) to (c2.north);
130+
\draw<2->[ref-arc] ([yshift=1.5em] c4.north) to (c4.north);
131+
\end{tikzpicture}
132+
\vspace{1em}
133+
\begin{itemize}
134+
\item \textbf{Normalfall mit Squash} (optional)
135+
\item<2-> Commit \texttt{c5c5c} ist Zusammenfassung des \texttt{feature}-Branches
136+
\item<2-> Commits \texttt{c2c2c} und \texttt{c4c4c} in Commit \texttt{c5c5c} nicht mehr sichtbar
137+
\end{itemize}
138+
\end{frame}
139+
140+
\subsection*{Merge Conflicts}
141+
\begin{frame}[fragile, c]
142+
\slidehead
143+
\vspace{1em}
144+
\begin{codeBlock}[]{minted language=java}
145+
public static void mul(int a, int b) {
146+
<<<<<<< HEAD:Calculator.java
147+
return a * b;
148+
=======
149+
for (int i = 0; i < b; i++) {
150+
a += a;
151+
}
152+
>>>>>>> feature:Calculator.java
153+
}
154+
\end{codeBlock}
155+
\end{frame}

chapters/rebasing.tex

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
\section{Rebasing}\label{sec:rebasing}
2+
3+
\begin{frame}
4+
\slidehead
5+
\centering
6+
\vspace{1em}
7+
\begin{tikzpicture}
8+
% 1 # create c1
9+
\node<1->[commit](c1){c1c1c} node[left=1em of c1]{$\dots$};
10+
% 1 # create master 1
11+
\node<1>[branch, right=2em of c1](m1){master};
12+
\draw<1>[parent] (m1) to (c1);
13+
% 1 # create c2
14+
\node<1-2>[commit, below=1em of m1](c2){c2c2c};
15+
\draw<1-2>[parent] (c2.west) to (c1.east);
16+
% 1 # create feature
17+
\node<1-2>[branch, right=2em of c2](fa1){feature};
18+
\draw<1-2>[parent] (fa1) to (c2);
19+
% 2 # create c3
20+
\node<2->[commit, right=2em of c1](c2){c3c3c};
21+
\draw<2->[parent] (c2.west) to (c1.east);
22+
% 2 # create master 2
23+
\node<2->[branch, right=2em of c3](m1){master};
24+
\draw<2->[parent] (m1) to (c3);
25+
% 3 # create c2
26+
\node<3->[commit, below=1em of m1](c2){c2c2c};
27+
\draw<3->[parent] (c2.west) to (c3.east);
28+
% 3 # create feature
29+
\node<3->[branch, right=2em of c2](fa1){feature};
30+
\draw<3->[parent] (fa1) to (c2);
31+
\end{tikzpicture}
32+
\vspace{1em}
33+
\begin{itemize}
34+
\item<2-> neuer Commit \texttt{c3c3c} auf \texttt{master}-branch
35+
\item<2-> Annahme: Commit \texttt{c3c3c} ist zur Weiterarbeit auf \texttt{feature}-Branch nötig
36+
\item<3-> \textbf{Rebase} ändert Base des ersten Commits auf \texttt{feature}-Branch
37+
\end{itemize}
38+
\end{frame}

chapters/staging.tex

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
\section{Staging}\label{sec:staging}
2+
3+
\begin{frame}[c]
4+
\slidehead
5+
\center
6+
\begin{tikzpicture}
7+
\node[node_inactive] (untracked) {untracked};
8+
\node[node_inactive, below=2.5em of untracked] (staged) {staged};
9+
\node[node_inactive, below=2.5em of staged] (unmodified) {unmodified};
10+
\node[node_inactive, below=2.5em of unmodified] (modified) {modified};
11+
\draw[parent-inactive] (untracked.south) -- (staged.north) node[right, pos=0.5] {\texttt{git add}};
12+
\draw[parent-inactive] (staged.south) -- (unmodified.north) node[right, pos=0.5] {\texttt{git commit}};
13+
\draw[parent-inactive] (unmodified.south) -- (modified.north) node[right, pos=.5] {Ändern};
14+
\draw[parent-inactive] (modified) to[out=180, in=180, looseness=1.5] node[left, pos=.5] {Ändern} (staged);
15+
\draw[parent-inactive] (modified) to[out=0,in=0, looseness=1.5] node[right, pos=.5] {\texttt{git rm}} (untracked);
16+
\node<7,2,3,6>[node] (untracked) {untracked};
17+
\node<7,3,4,6>[node, below=2.5em of untracked] (staged) {staged};
18+
\node<7,4,5>[node, below=2.5em of staged] (unmodified) {unmodified};
19+
\node<7,5,6>[node, below=2.5em of unmodified] (modified) {modified};
20+
\draw<7,3>[parent] (untracked.south) -- (staged.north) node[right, pos=0.5] {\texttt{git add}};
21+
\draw<7,4>[parent] (staged.south) -- (unmodified.north) node[right, pos=0.5] {\texttt{git commit}};
22+
\draw<7,5>[parent] (unmodified.south) -- (modified.north) node[right, pos=.5] {Ändern};
23+
\draw<7,6>[parent] (modified) to[out=180, in=180, looseness=1.5] node[left, pos=.5] {Ändern} (staged);
24+
\draw<7,6>[parent] (modified) to[out=0,in=0, looseness=1.5] node[right, pos=.5] {\texttt{git rm}} (untracked);
25+
\end{tikzpicture}
26+
\end{frame}

common/packages.tex

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
\usepackage{tikz}
3333
\usetikzlibrary{3d, angles, animations, arrows, arrows.meta, arrows.spaced, automata, babel, backgrounds, bending, calc, calendar, chains, circuits.ee.IEC, circuits.logic.CDH, circuits.logic.IEC, circuits.logic.US, datavisualization, datavisualization.formats.functions, datavisualization.polar, decorations, decorations.footprints, decorations.fractals, decorations.markings, decorations.pathmorphing, decorations.pathreplacing, decorations.shapes, decorations.text, er, external, fadings, fit, fixedpointarithmetic, folding, fpu, graphs, graphs.standard, intersections, lindenmayersystems, math, matrix, patterns, patterns.meta, perspective, petri, plotmarks, positioning, quotes, rdf, scopes, shadings, shadows, shadows.blur, shapes, shapes.arrows, shapes.callouts, shapes.gates.logic.IEC, shapes.gates.logic.US, shapes.geometric, shapes.misc, shapes.multipart, shapes.symbols, spy, svg.path, through, tikzmark, topaths, trees, turtle, views}
3434

35-
\tikzset{%
35+
\tikzset{
3636
commit/.style={
3737
rectangle,
3838
text=white,
@@ -62,5 +62,19 @@
6262
}
6363
},
6464
parent/.style={-Latex, thick},
65+
parent-inactive/.style={parent, draw=TUDa-0a, text=TUDa-0a},
6566
ref-arc/.style={parent, dashed},
67+
node/.style={
68+
rectangle,
69+
text=white,
70+
fill=TUDa-0c,
71+
very thick,
72+
minimum width=8em,
73+
minimum height=2em,
74+
},
75+
node_inactive/.style={
76+
node,
77+
rounded corners=1em,
78+
fill=TUDa-0a,
79+
},
6680
}

0 commit comments

Comments
 (0)