Sei (k)ein Blödmann und nimm Git! Einführung in Versionskontrolle mit Git Stefan Imhoff stefanimhoff.de Django-UserGroup Hamburg 04.08.2009
Sei (k)ein
Blödmannund nimm Git!Einführung in Versionskontrolle mit Git
Stefan Imhoffstefanimhoff.deDjango-UserGroup Hamburg04.08.2009
Git /gɪt/Nomen (Britisch, Slang)
1. Blödmann, Depp, Idiot
»Ich bin ein egoistischer Bastard und benenne alle meine Projekte nach mir selbst. Zuerst Linux, jetzt Git.«
– Linus Torvalds
Fakten & StatistikenWarum Git die Mitbewerber abhängt
Git Mercurial Bazaar
0,60
0,0590,024
Init (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
2,3810,368
8,535
Add (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
14,744
1,9460,451
Status (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
14,248
2,1890,543
Diff (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
1,892
1,201
0,056
Tag (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
9,055
2,650,711
Log (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
23,002
12,512,48
Commit, groß (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
1,139
0,5170,086
Commit, klein (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
82,24994,681
1,161
Branch, kalt (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar
39,411
12,30,07
Branch, heiß (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar Subversion
6164
53
43 45
34
24
Repository (MB)Gesamtes Verzeichnis (MB)
Quelle: Scott Chacon, whygitisbetterthanx.com
Git Mercurial Bazaar Subversion
64
311
144119
Clone (Sekunden)
Quelle: Scott Chacon, whygitisbetterthanx.com
Theorie & GrundlagenWer das versteht, ist klar im Vorteil …
.git
SHA-I
Hallo, Welt!
8095a184a9b9ae8a14a0f0cde697c7f7cf1410e6
Meta-Informationen(Datum, Name, Ort)
Warum?• Konsistente Inhalte• Gleicher Inhalt = gleicher Blob
Objekte
• blobs• trees• commits• tags
Blobs
Dateiinhalte
Trees
• blobs• trees
Commits
• tree• parent• author• commiter• message• datetime
Tags
• object• type• tagger• message
KonfigurationSag mir wie du heißt, Baby!
git config
git config --global user.name "Stefan Imhoff"git config --global user.email "[email protected]"
.gitignore
Tägliche ArbeitBusiness, not as usual
git clone
git init
git status
Working Directory
Local
git add
Working Directory
StagingArea
git add
Local
git commit
Working Directory
StagingArea
LocalRepository
git add
git commit
Local
master
git log
git rm
git diff
git branch
master
neuerzweig
git checkout
Working Directory
StagingArea
LocalRepository
git add
git commit
git checkout
Local
git merge
Working Directory
StagingArea
LocalRepository
git add
git commit
git checkout
git merge
Local
master
neuerzweig
git tag
Probleme & WartungKeine Panik auf der Titanic
git commit --amend
git checkout
git reset
git blame
git revert
git mergetool
git bisect
BadGood ?
BadGood Good ?
BadGood Good Bad?
git gc
RemoteE.T. nach Hause telefonieren
Lokales Repository veröffentlichen
git remote
git fetch
Working Directory
StagingArea
LocalRepository
Remote Repository
git add
git commit
git fetch
git checkout
git merge
Local Remote
git pull
Working Directory
StagingArea
LocalRepository
Remote Repository
git add
git commit
git fetch
git checkout
git merge
Local Remote
git push
Working Directory
StagingArea
LocalRepository
Remote Repository
git add
git commit
git push
git checkout
git merge
Local Remote
git fetch
git submodules
Profi-TechikenDer Wuxi-Fingergriff von Git
Leere Branches anlegen
History verändern
git svn
git svn rebasegit svn dcommit
git instaweb
git stash
Klicki-BuntiAber gibt’s dat auch für Maus?
Git Gui
Git Extensions
TortoiseGit
GitK
GitX
Und los geht’s …Bereit Versionsgeschichtezu schreiben?
Vielen Dank!
Eingesetzte FotosDie in dieser Präsentation eingesetztenFotos stammen von iStockphoto.
8916384 7941768 3391085 1945196 5823044 2699704
7952299 3142537 7420635 7692057 4144887
Eingesetzte SchriftenDelicious http://www.josbuivenga.demon.nl/delicious.html
Baskerville (&)
Fragen & Antworten