|
| 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} |
0 commit comments