Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sven Greiner
git-workshop
Commits
e525bd88
Commit
e525bd88
authored
Mar 23, 2017
by
Sven Greiner
Browse files
Aufgaben
parent
9e1fb703
Changes
4
Hide whitespace changes
Inline
Side-by-side
test-icon.png
0 → 100644
View file @
e525bd88
71.1 KB
tipp-icon.jpg
0 → 100644
View file @
e525bd88
31.1 KB
tipp-icon.png
0 → 100644
View file @
e525bd88
31.6 KB
vortrag.tex
View file @
e525bd88
...
...
@@ -11,6 +11,7 @@
\usepackage
{
xspace
}
\xspaceaddexceptions
{
"=
}
\usepackage
{
microtype
}
\usepackage
{
environ
}
\usepackage
{
multicol
}
\usepackage
{
tabu
}
...
...
@@ -33,6 +34,21 @@
\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 ---------------------------------------------------------
\usetheme
{
default
}
\usecolortheme
{
rose
}
...
...
@@ -125,7 +141,7 @@
commit fill=white,
gitlog/.style=
{
line width=2pt, out=0, in=180, looseness=1.5, gitnormalcolor
}
,
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
{
\githead
}
[1]
{
pic
{
head=#1
}}
...
...
@@ -134,6 +150,39 @@
\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}
...
...
@@ -209,7 +258,25 @@
\item
\lstinline
{
\$
git init
}
\item
Fertig
\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}
\begin{frame}
{
Mein erster Commit
}
...
...
@@ -274,6 +341,25 @@
\end{itemize}
\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}
\vskip
1.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{columns}
\column
{
.5
\textwidth
}
...
...
@@ -327,13 +413,32 @@
\end{columns}
\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}
\vskip
2em
\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]
\frametitle
<1->
{
Auf verzweigten Wegen: Branches
}
\frametitle
<6>
{
Und wieder vereint: Merges
}
\begin{center}
\begin{minipage}
{
.6
\linewidth
}
\uncover
<2->
{
\lstinline
{
\$
git checkout -
-branch
<NAME>
}}
\uncover
<2->
{
\lstinline
{
\$
git checkout -
b
<NAME>
}}
\uncover
<3->
{
\lstinline
{
\$
git commit -a
}}
...
...
@@ -404,6 +509,85 @@
% TODO
\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}
\vskip
3em
\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}
\vskip
2em
\hfill
\begin{helpbox}
{
40mm
}
\lstinline
{
git checkout
}
\\
\lstinline
{
git rebase
}
\end{helpbox}
\end{frame}
\begin{frame}
{
Verteiltes Arbeiten: Remotes
}
\begin{itemize}
\item
Git ist dezentral -- kann aber zentral genutzt werden
...
...
@@ -412,8 +596,8 @@
\begin{center}
\begin{tikzpicture}
\tikzset
{
remote/.style=
{
draw, cylinder, minimum height=8mm, minimum width=10mm, shape border rotate=90, aspect=0.3
}
,
computer/.style=
{
draw
}
,
remote/.style=
{
draw,
fill=gitbranchcolor!30,
cylinder, minimum height=8mm, minimum width=10mm, shape border rotate=90, aspect=0.3
}
,
computer/.style=
{
draw
, fill=lightgray, rounded corners=2pt, opacity=0.4
}
,
user/.style=
{
font=
\footnotesize
}
,
}
...
...
@@ -423,7 +607,7 @@
\node
[remote]
(D) at (1,-1.5)
{
D
}
;
\node
[remote]
(E) at (3,-1.5)
{
E
}
;
\draw
\draw
[thick]
(D) edge (C)
(D) edge (A)
(D) edge (B)
...
...
@@ -431,8 +615,10 @@
\node
[user]
(U1) at (0,-2.2)
{
User 1
}
;
\node
[user]
(U2) at (3,-2.2)
{
User 2
}
;
\node
[computer, fit=(C)(D)(U1)]
{}
;
\node
[computer, fit=(E)(U2)]
{}
;
\begin{pgfonlayer}
{
background
}
\node
[computer, fit=(C)(D)(U1)]
{}
;
\node
[computer, fit=(E)(U2)]
{}
;
\end{pgfonlayer}
\end{tikzpicture}
\end{center}
...
...
@@ -500,53 +686,27 @@
\end{frame}
\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}
\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
$
\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{frame}
\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}
\begin{frame}
\includegraphics
[width=\linewidth, trim=5mm 25mm 5mm 33mm, clip]
{
git-transport-v1
}
\end{frame}
\begin{frame}
{
Wenn's mal schief läuft: Revert
}
...
...
@@ -609,6 +769,23 @@
\end{textblock}
\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}
\vskip
2.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{center}
\includegraphics
[width=.6\linewidth, trim=0 0 0 15mm, clip]
{
git-push-force
}
...
...
@@ -655,6 +832,24 @@
\end{textblock}
\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{itemize}
\item
man pages von Git:
\quad
\lstinline
{
\$
man git-<BEFEHL>
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment