SlideShare a Scribd company logo
HOGENT 14/04/16
WIE BEN IK?
BIO
▸Thomas Nys
▸1986
▸Hamme /
Gent
WIE BEN IK?
PROFESSIONEEL
▸Ruby On Rails
▸Rialto
(PropTech
startup)
WIE BEN IK?
HOBBYS
▸Lezen
▸Ruby Belgium
▸Crossfit
▸Elixir
WIE BEN IK?
OVERZICHT
▸ Git history
▸ Git basics
▸ Commit messages
▸ Merge vs rebase
▸ Merge conflicts
▸ Workflow
▸ Git voodoo
▸ Git resources
GIT HISTORY
I'M DOING A (FREE) OPERATING SYSTEM
(JUST A HOBBY, WON'T BE BIG AND
PROFESSIONAL LIKE GNU) FOR 386(486)
AT CLONES.
Linus Torvalds, 25-08-1991
GIT HISTORY
LINUS TORVALDS
▸Finse programmeur
▸Vader linux-kernel
▸Ontevreden met
CVS
GIT HISTORY
NODEN
▸Performant
▸Gedistribueerd
▸Fout-tolerant
GIT HISTORY
BITKEEPER
▸ Gratis voor Linux-maintainers (niet opensource)
▸ Iemand probeert Bitkeeper te reverse
engineeren
▸ Bitkeeper stopt met Linux te steunen
▸ April 2005 gestart met eerste versie git
GIT HISTORY
GIT BASICS
SNAPSHOTS GEEN DELTAS
▸ Andere VCS’en
== delta’s van
een bepaalde
basefile
▸ Git == stream van
snapshots
GIT BASICS
ALLES LOKAAL
▸Gedistribueerd model
▸Snelheid!
▸Offline werken
GIT BASICS
GIT == DATA-INTEGRITEIT
▸ Alles in git gechecksummed met SHA-1
hash naar een hexadecimale string van 40
karakters
▸ Elke wijziging opspoorbaar
▸ Alles is omkeerbaar
GIT BASICS
3 STADIA
▸ Modified
▸ Gewijzigd maar niet opgeslagen
▸ Staged
▸ Klaargezet om te committen
▸ Cmmitted
▸ “Opgeslagen”
GIT BASICS
BRANCHING
▸Branch is een snapshot van de situatie
op het moment waar de branch
afgetakt is
▸Branch is letterlijk een aftakking
▸Je kan branchen op een branch
GIT BASICS
.GITIGNORE
▸ File met te negeren bestanden
▸ Typisch voor bestanden met gevoelige informatie of
tijdelijke bestanden
▸ Repo basis: vb file met database-wachtwoorden
▸ Globaal hele systeem: vb. tmp-files typisch voor het OS
GIT BASICS
DEMO
GIT BASICS
COMMIT
MESSAGES
7 REGELS VOOR EEN GOEDE COMMIT MESSAGE
1. Hou onderwerp en body gescheiden met 1 witregel
2. Beperk de lengte van het onderwerp tot 50 karakters
3. Het onderwerp begint met een hoofdletter
4. Gebruik geen punt op het einde van het onderwerp
5. Gebruik de gebiedende wijs in het onderwerp
6. Beperk de breedte van de body to 72 karakters
7. Geef in je body een uitleg voor wat en waarom, niet over hoe
COMMIT MESSAGES
MEER OVER COMMIT MESSAGES
▸ Een rant van Linus Torvalds over commit-messages:
▸ https://github.com/torvalds/linux/pull/
17#issuecomment-5659933
▸ Blogpost die dieper ingaat op deze 7 regels:
▸ http://chris.beams.io/posts/git-commit/
COMMIT MESSAGES
MERGE VS
REBASE
MERGE
▸ Makkelijkst
▸ Laat de geschiedenis as
is
▸ Extra commit iedere
keer changes van master
worden gemerged
▸ Geeft een heel slordige
git-history
▸ Minder geschikt voor
team-werk
MERGE VS REBASE
REBASE
▸ Iets geavanceerder
▸ Geen overbodige
merge-commits
▸ Mooie lineaire
geschiedenis
▸ Geschiedenis
herschreven, niet
gebruiker op publieke
branches
MERGE VS REBASE
MERGE
CONFLICTS
WANNEER?
▸ Wanneer eenzelfde lijn in eenzelfde bestand is aangepast
in 2 branches.
▸ Wanneer een file in 1 branch verwijderd is maar in een
andere gewijzigd.
MERGE CONFLICTS
DEMO
MERGE CONFLICTS
WORKFLOW
(in kleine teams)
GITHUB
▸ Marktleider hosting git-repo’s
▸ Meeste open-source projecten zitten op git
GITLAB
▸ Evenwaardig maar kleiner
▸ Snelle progressie
▸ Kan sneller groeien door te leren uit fouten github
WORKFLOW
BASICS
▸ Master == productie-code
▸ Nooit pushen naar master !!!
▸ Iedereen branched op master
▸ Indien feature:
▸ branchnaam: feature/coole-feature
▸ Indien bug:
▸ branchnaam: bug/het-is-kapot
WORKFLOW
CODE TERUG NAAR MASTER
▸ Indien de feature/bug klaar —> PR op Github
▸ Rebasen met master (changes in master naar branch brengen)
▸ Wordt toegewezen aan iemand van het team en nagekeken
▸ Code review is een leerrijk proces en geen ego-kwestie
▸ Jij bent je code niet
▸ Stijl en syntax automatisch laten checken (voorkomt al heel wat ego-zaken)
▸ Zorg voor een ci die automatisch testen loopt en zo al een eerste vorm van
feedback geeft, testen falen == probleem
▸ Indien ok de pull-request gemerged en automatisch een deploy naar productie
WORKFLOW
DEMO
WORKFLOW
GIT VOODOO
▸ git rebase -i
▸ git fixup & autosquash
▸ git bisect
▸ git cherry-pick
▸ git add -patch
▸ git add -i
▸ git reflog
▸ tig
▸ git-extras
GIT VOODOO
GIT RESOURCES
▸ Officiële documentatie:
▸ https://git-scm.com/
▸ Podcast
▸ https://www.briefs.fm/git-tips
▸ Interactieve cheatsheet:
▸ http://ndpsoftware.com/git-cheatsheet.html
▸ Tutorial:
▸ https://www.atlassian.com/git/tutorials/
▸ Meer info over .git-folder
▸ https://medium.freecodecamp.com/understanding-git-for-real-by-
exploring-the-git-directory-1e079c15b807#.gmhespqdy
THX!
Nog vragen?
Twitter: @nysthee
Email: nysthee@gmail.com

More Related Content

PDF
Introduction to NServiceBus
KEY
Git techtalk
PDF
Git for the win!
PDF
CraftCamp for Students - Introduction to git
PDF
Introduction to Git
PDF
An introduction to git
PDF
Git - The Incomplete Introduction
PPTX
Intro to NuGet
Introduction to NServiceBus
Git techtalk
Git for the win!
CraftCamp for Students - Introduction to git
Introduction to Git
An introduction to git
Git - The Incomplete Introduction
Intro to NuGet

Viewers also liked (13)

PDF
Git in gear: How to track changes, travel back in time, and code nicely with ...
PPTX
GIT Fundamentals
PDF
Git advanced
PDF
A painless git workflow
PDF
How to store large binary files in git repositories
PDF
Version Control & Git
PDF
What is version control software and why do you need it?
ODP
Introduction to Version Control
PPT
Git 101 - Crash Course in Version Control using Git
PPTX
Introduction to Git/Github - A beginner's guide
PDF
Git 101: Git and GitHub for Beginners
PDF
UX, ethnography and possibilities: for Libraries, Museums and Archives
Git in gear: How to track changes, travel back in time, and code nicely with ...
GIT Fundamentals
Git advanced
A painless git workflow
How to store large binary files in git repositories
Version Control & Git
What is version control software and why do you need it?
Introduction to Version Control
Git 101 - Crash Course in Version Control using Git
Introduction to Git/Github - A beginner's guide
Git 101: Git and GitHub for Beginners
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ad

Git Hogent