Commit e525bd88 authored by Sven Greiner's avatar Sven Greiner
Browse files

Aufgaben

parent 9e1fb703
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
\usepackage{xspace} \usepackage{xspace}
\xspaceaddexceptions{"=} \xspaceaddexceptions{"=}
\usepackage{microtype} \usepackage{microtype}
\usepackage{environ}
\usepackage{multicol} \usepackage{multicol}
\usepackage{tabu} \usepackage{tabu}
...@@ -33,6 +34,21 @@ ...@@ -33,6 +34,21 @@
\usepackage{hyperref} \usepackage{hyperref}
%--- fix "transparent" compatibility with TikZ ---------------------------------
\makeatletter
\begingroup\expandafter\expandafter\expandafter\endgroup
\expandafter\ifx\csname pgfutil@addpdfresource@extgs\endcsname\relax
\else
\AtBeginDocument{%
\pgfutil@addpdfresource@extgs{%
\TRP@list
}%
}%
\let\TRP@addresource\relax
\fi
\makeatother
%--- colors and layout --------------------------------------------------------- %--- colors and layout ---------------------------------------------------------
\usetheme{default} \usetheme{default}
\usecolortheme{rose} \usecolortheme{rose}
...@@ -125,7 +141,7 @@ ...@@ -125,7 +141,7 @@
commit fill=white, commit fill=white,
gitlog/.style={line width=2pt, out=0, in=180, looseness=1.5, gitnormalcolor}, gitlog/.style={line width=2pt, out=0, in=180, looseness=1.5, gitnormalcolor},
gitbranch/.style={gitlog, gitbranchcolor}, gitbranch/.style={gitlog, gitbranchcolor},
commitlabel/.style={draw=none, above=3pt of x, font=\footnotesize, color=black}, commitlabel/.style={draw=none, above=3pt of x, font=\small\ttfamily, color=black},
} }
\newcommand{\gitcommit}[1]{pic {commit=#1}} \newcommand{\gitcommit}[1]{pic {commit=#1}}
\newcommand{\githead}[1]{pic {head=#1}} \newcommand{\githead}[1]{pic {head=#1}}
...@@ -134,6 +150,39 @@ ...@@ -134,6 +150,39 @@
\newcommand{\gitskip}{to ++(1,0)} \newcommand{\gitskip}{to ++(1,0)}
%--- task boxes ----------------------------------------------------------------
\definecolor{taskboxcolor}{HTML}{9CCB5B}
\NewEnviron{taskbox}[1]{%
\begin{tikzpicture}
\node[inner sep=0] (content) {\begin{minipage}{#1}
\setlength{\leftmargini}{1em}
\BODY
\end{minipage}};
\node[inner sep=0, left=4mm of content.north west, anchor=north east] (icon) {\includegraphics[width=10mm]{test-icon}};
\begin{pgfonlayer}{background}
\node[fill=taskboxcolor!30, line width=2pt, rounded corners=5pt, inner sep=8pt, fit=(icon)(content)] {};
\end{pgfonlayer}
\end{tikzpicture}
}
\definecolor{helpboxcolor}{HTML}{FDC400}
\NewEnviron{helpbox}[1]{%
\begin{tikzpicture}
\node[inner sep=0] (content) {\begin{minipage}{#1}
\setlength{\leftmargini}{1em}
\BODY
\end{minipage}};
\node[inner sep=0, left=4mm of content.north west, anchor=north east] (icon) {\includegraphics[width=10mm]{tipp-icon}};
\begin{pgfonlayer}{background}
\node[fill=helpboxcolor!25, line width=2pt, rounded corners=5pt, inner sep=8pt, fit=(icon)(content)] {};
\end{pgfonlayer}
\end{tikzpicture}
}
\begin{document} \begin{document}
...@@ -209,7 +258,25 @@ ...@@ -209,7 +258,25 @@
\item \lstinline{\$ git init} \item \lstinline{\$ git init}
\item Fertig \item Fertig
\end{enumerate} \end{enumerate}
% TODO Leerer Platz
\only<2->{
\begin{textblock}{75}(75,20)
\begin{taskbox}{55mm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Lege deinen Namen und deine E"=Mail"=Adresse fest
\item Erstelle einen neuen Ordner und lege ein Git"=Repository an
\end{itemize}
\end{taskbox}
\end{textblock}
\begin{textblock}{75}(40,65)
\begin{helpbox}{90mm}
\lstinline{\$ git config --global user.name \ldots} \\
\lstinline{\$ git config --global user.email \ldots}
\end{helpbox}
\end{textblock}
}
\end{frame} \end{frame}
\begin{frame}{Mein erster Commit} \begin{frame}{Mein erster Commit}
...@@ -274,6 +341,25 @@ ...@@ -274,6 +341,25 @@
\end{itemize} \end{itemize}
\end{frame} \end{frame}
\begin{frame}
\begin{taskbox}{9cm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Erstelle ein paar Dateien, füge sie dem Index hinzu und committe sie!
\item Ändere Dateien, füge welche hinzu und lösche eine Datei. Erstelle zwischendurch Commits.
\item Was konntest du beobachten? Worauf musstest du achten?
\end{itemize}
\end{taskbox}
\vskip1.5em
\hfill
\begin{helpbox}{100mm}
\lstinline{git add -A},\quad \lstinline{git add <DATEI>} \\
\lstinline{git commit},\quad \lstinline{git commit -a},\quad \lstinline{git commit <DATEI>} \\
\lstinline{git status}
\end{helpbox}
\end{frame}
\begin{frame}{Was war, was ist und was sein wird} \begin{frame}{Was war, was ist und was sein wird}
\begin{columns} \begin{columns}
\column{.5\textwidth} \column{.5\textwidth}
...@@ -327,13 +413,32 @@ ...@@ -327,13 +413,32 @@
\end{columns} \end{columns}
\end{frame} \end{frame}
\begin{frame}
\begin{taskbox}{95mm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Schau dir an, was du gemacht hast.
\item Probier auch mal, Dateien zu ändern (ohne sie zu committen) und schau dir die Änderungen an.
\item Finde heraus, wie man sich eine Liste der geänderten Dateien im Log anschauen kann.
\end{itemize}
\end{taskbox}
\vskip2em
\hfill
\begin{helpbox}{70mm}
\lstinline{git diff},\quad \lstinline{git diff A..B} \\
\lstinline{git show},\quad \lstinline{git show A} \\
\lstinline{git log},\quad \lstinline{git status},\quad \lstinline{man git-log}
\end{helpbox}
\end{frame}
\begin{frame}<-5>[label=branchmerge] \begin{frame}<-5>[label=branchmerge]
\frametitle<1->{Auf verzweigten Wegen: Branches} \frametitle<1->{Auf verzweigten Wegen: Branches}
\frametitle<6>{Und wieder vereint: Merges} \frametitle<6>{Und wieder vereint: Merges}
\begin{center} \begin{center}
\begin{minipage}{.6\linewidth} \begin{minipage}{.6\linewidth}
\uncover<2->{\lstinline{\$ git checkout --branch <NAME>}} \uncover<2->{\lstinline{\$ git checkout -b <NAME>}}
\uncover<3->{\lstinline{\$ git commit -a}} \uncover<3->{\lstinline{\$ git commit -a}}
...@@ -404,6 +509,85 @@ ...@@ -404,6 +509,85 @@
% TODO % TODO
\end{frame} \end{frame}
\begin{frame}
\begin{taskbox}{75mm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Lege Branches an, mache Commits, wechsle Branches
\item Merge Branches, achte auf Konflikte!
\end{itemize}
\end{taskbox}
\vskip3em
\hfill
\begin{helpbox}{90mm}
\lstinline{git branch <NAME>},\quad \lstinline{git checkout -b <NAME>} \\
\lstinline{git checkout <NAME>},\quad \lstinline{git merge <NAME>}
\end{helpbox}
\end{frame}
\begin{frame}{Schönere History: Rebase}
\begin{itemize}
\item<2-> Commit in Master
\item<3-> Merge würde einen Merge-Commit erzeugen
\item<4-> Stattdessen:\quad \only<5->{\lstinline{\$ git rebase master}}
\item<6-> \lstinline{\$ git checkout master \&\& git merge <NAME>}
\medskip
$\quad\implies$ Fast-Forward
\end{itemize}
\bigskip
\begin{center}
\begin{tikzpicture}[y=-1cm]
\path[use as bounding box] (-0.5,-0.7) rectangle (5.5,1.3);
\only<1>{
\draw[gitbranch] (1,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B};
}
\only<2,4>{
\draw[gitbranch] (1,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D};
}
\only<3>{
\draw[gitbranch] (1,0) \gitbranch \gitcommit{C} \gitmerge;
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D} \gitskip \gitskip \githead{E};
}
\only<5>{
\draw[gitbranch] (3,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D};
}
\only<6>{
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D} \gitskip \gitskip \githead{C};
}
\end{tikzpicture}
\end{center}
\end{frame}
\begin{frame}
\begin{taskbox}{95mm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Committe etwas in einem anderen Branch
\item Erstelle einen Commit in \lstinline{master}
\item Rebase den ersten Branch auf \lstinline{master}
\item Mache einen Fast"=Forward Merge in \lstinline{master}
\end{itemize}
\end{taskbox}
\vskip2em
\hfill
\begin{helpbox}{40mm}
\lstinline{git checkout} \\
\lstinline{git rebase}
\end{helpbox}
\end{frame}
\begin{frame}{Verteiltes Arbeiten: Remotes} \begin{frame}{Verteiltes Arbeiten: Remotes}
\begin{itemize} \begin{itemize}
\item Git ist dezentral -- kann aber zentral genutzt werden \item Git ist dezentral -- kann aber zentral genutzt werden
...@@ -412,8 +596,8 @@ ...@@ -412,8 +596,8 @@
\begin{center} \begin{center}
\begin{tikzpicture} \begin{tikzpicture}
\tikzset{ \tikzset{
remote/.style={draw, cylinder, minimum height=8mm, minimum width=10mm, shape border rotate=90, aspect=0.3}, remote/.style={draw, fill=gitbranchcolor!30, cylinder, minimum height=8mm, minimum width=10mm, shape border rotate=90, aspect=0.3},
computer/.style={draw}, computer/.style={draw, fill=lightgray, rounded corners=2pt, opacity=0.4},
user/.style={font=\footnotesize}, user/.style={font=\footnotesize},
} }
...@@ -423,7 +607,7 @@ ...@@ -423,7 +607,7 @@
\node[remote] (D) at (1,-1.5) {D}; \node[remote] (D) at (1,-1.5) {D};
\node[remote] (E) at (3,-1.5) {E}; \node[remote] (E) at (3,-1.5) {E};
\draw \draw[thick]
(D) edge (C) (D) edge (C)
(D) edge (A) (D) edge (A)
(D) edge (B) (D) edge (B)
...@@ -431,8 +615,10 @@ ...@@ -431,8 +615,10 @@
\node[user] (U1) at (0,-2.2) {User 1}; \node[user] (U1) at (0,-2.2) {User 1};
\node[user] (U2) at (3,-2.2) {User 2}; \node[user] (U2) at (3,-2.2) {User 2};
\begin{pgfonlayer}{background}
\node[computer, fit=(C)(D)(U1)] {}; \node[computer, fit=(C)(D)(U1)] {};
\node[computer, fit=(E)(U2)] {}; \node[computer, fit=(E)(U2)] {};
\end{pgfonlayer}
\end{tikzpicture} \end{tikzpicture}
\end{center} \end{center}
...@@ -500,53 +686,27 @@ ...@@ -500,53 +686,27 @@
\end{frame} \end{frame}
\begin{frame}{Pull im Detail} \begin{frame}{Pull im Detail}
\end{frame}
\begin{frame}
\includegraphics[width=\linewidth, trim=5mm 25mm 5mm 33mm, clip]{git-transport-v1}
\end{frame}
\begin{frame}{Schönere History: Rebase}
\begin{itemize} \begin{itemize}
\item<2-> Commit in Master \item \lstinline{git pull} = \lstinline{git fetch \&\& git merge}\quad (Jedenfalls fast)
\item<3-> Merge würde einen Merge-Commit erzeugen \bigskip
\item<4-> Stattdessen:\quad \only<5->{\lstinline{\$ git rebase master}} \item \lstinline{git fetch} holt Daten von einem Remote und aktualisiert Remote Tracking Branches
\item<6-> \lstinline{\$ git checkout master \&\& git merge <NAME>} \bigskip
\item Merge lässt sich durch Rebase ersetzen:
\medskip \medskip
$\quad\implies$ Fast-Forward \lstinline{\$ git pull --rebase} \\
\medskip
\lstinline{\$ git config branch.<name>.rebase true} \\
\lstinline{\$ git config pull.rebase true}
\end{itemize} \end{itemize}
\end{frame}
\bigskip \begin{frame}
\includegraphics[width=\linewidth, trim=5mm 25mm 5mm 33mm, clip]{git-transport-v1}
\begin{center}
\begin{tikzpicture}[y=-1cm]
\path[use as bounding box] (-0.5,-0.7) rectangle (5.5,1.3);
\only<1>{
\draw[gitbranch] (1,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B};
}
\only<2,4>{
\draw[gitbranch] (1,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D};
}
\only<3>{
\draw[gitbranch] (1,0) \gitbranch \gitcommit{C} \gitmerge;
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D} \gitskip \gitskip \githead{E};
}
\only<5>{
\draw[gitbranch] (3,0) \gitbranch \githead{C};
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D};
}
\only<6>{
\draw[gitlog] (0,0) \gitcommit{A} \gitskip \gitcommit{B} \gitskip \gitskip \gitcommit{D} \gitskip \gitskip \githead{C};
}
\end{tikzpicture}
\end{center}
\end{frame} \end{frame}
\begin{frame}{Wenn's mal schief läuft: Revert} \begin{frame}{Wenn's mal schief läuft: Revert}
...@@ -609,6 +769,23 @@ ...@@ -609,6 +769,23 @@
\end{textblock} \end{textblock}
\end{frame} \end{frame}
\begin{frame}
\begin{taskbox}{80mm}
\begin{itemize}
\setlength{\itemsep}{1em}
\item Ändere etwas am HEAD
\item Reverte einen deiner Commits
\end{itemize}
\end{taskbox}
\vskip2.5em
\hfill
\begin{helpbox}{45mm}
\lstinline{git commit --amend} \\
\lstinline{git revert}
\end{helpbox}
\end{frame}
\begin{frame}{(Do NOT) Use the \--\--force, Luke!} \begin{frame}{(Do NOT) Use the \--\--force, Luke!}
\begin{center} \begin{center}
\includegraphics[width=.6\linewidth, trim=0 0 0 15mm, clip]{git-push-force} \includegraphics[width=.6\linewidth, trim=0 0 0 15mm, clip]{git-push-force}
...@@ -655,6 +832,24 @@ ...@@ -655,6 +832,24 @@
\end{textblock} \end{textblock}
\end{frame} \end{frame}
% \begin{frame}{Ein paar typische Workflows}
% \begin{center}
% \begin{tikzpicture}[y=-1cm]
% \tikzset{branchlabel/.style={draw=none, anchor=east, font=\small\ttfamily}}
%
% \draw[gitbranch] (0,2) \gitmerge \gitcommit{} \gitskip \gitcommit{} \gitmerge ++(-2,1) \gitskip \gitbranch to ++(2,-2);
% \draw[gitbranch] (1,0) \gitmerge \gitcommit{} \gitskip \gitcommit{} \gitbranch;
% \draw[gitlog] (0,0) \gitskip \gitcommit{} \gitskip \gitskip \gitcommit{} \gitskip \gitskip \gitcommit{} \gitskip \gitcommit{} \gitskip \gitskip \gitcommit{} ++(1,0);
% \draw[gitlog] (0,2) to ++(6,0) \gitcommit{};
%
% \node[branchlabel] at (-.2,-1) {feature};
% \node[branchlabel] at (-.2,0) {master};
% \node[branchlabel] at (-.2,1) {bugfix};
% \node[branchlabel] at (-.2,2) {release};
% \end{tikzpicture}
% \end{center}
% \end{frame}
\begin{frame}{Hilfreiche Seiten} \begin{frame}{Hilfreiche Seiten}
\begin{itemize} \begin{itemize}
\item man pages von Git:\quad \lstinline{\$ man git-<BEFEHL>} \item man pages von Git:\quad \lstinline{\$ man git-<BEFEHL>}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment