Gitting Things Done
Juliette Reinders Folmer
Tweet about it: @jrf_nl
Slide 2
Slide 2 text
What is
Git ?
Linnaea Mallette
Slide 3
Slide 3 text
About Forks & Remotes
Slide 4
Slide 4 text
“
There is no one truth
kconnors
Slide 5
Slide 5 text
Original Repo Fork A Fork B
Slide 6
Slide 6 text
Original Repo Fork A Fork B
Slide 7
Slide 7 text
Original Repo Fork A Fork B
Slide 8
Slide 8 text
Original Repo Fork A Fork B
Slide 9
Slide 9 text
“
There is no limit to the amount
of remotes you can add
or that can exist
Slide 10
Slide 10 text
Pull
I accept your truth as my truth
Slide 11
Slide 11 text
Push
My truth is now your truth
Slide 12
Slide 12 text
Pull Request
Will you accept my truth
as your truth ?
Slide 13
Slide 13 text
Merging a PR
Thanks for asking.
I accept your truth as my truth
Slide 14
Slide 14 text
About
Branches
Paul de Bruin
Slide 15
Slide 15 text
Branches are your
Save Points
Slide 16
Slide 16 text
COPY/DEL
TEMP
PR
WAIT-FOR
WIP
TODO
Use Branches Liberally
Slide 17
Slide 17 text
How to Write
History and Get
Your PRs Accepted
Slide 18
Slide 18 text
Useful ?
Slide 19
Slide 19 text
Decypherable ?
Slide 20
Slide 20 text
Clean
Slide 21
Slide 21 text
“
A clean history requires
forethought and discipline
kconnors
Slide 22
Slide 22 text
Atomic Commits
Pass CI
Easy to Review
Focus on
One Thing
Self-contained
Slide 23
Slide 23 text
Atomic Commits
===
Story Telling
Slide 24
Slide 24 text
Tools of The Trade
▪ Amend
Steve Buissinne
Slide 25
Slide 25 text
Tools of The Trade
▪ Amend
▪ Interactive Rebase
Maria Yan
Slide 26
Slide 26 text
Rebase
Slide 27
Slide 27 text
Rebase
Slide 28
Slide 28 text
Interactive Rebase
Slide 29
Slide 29 text
Interactive Rebase
Slide 30
Slide 30 text
squash
pick
fixup
drop
edit
reword
Interactive Rebase
Slide 31
Slide 31 text
No content
Slide 32
Slide 32 text
No content
Slide 33
Slide 33 text
No content
Slide 34
Slide 34 text
No content
Slide 35
Slide 35 text
Squash vs Fixup
▪ Combines changes
into one commit
▪ Combines the
commit messages +
presents for edit
▪ Combines changes
into one commit
▪ Throws away all but
the original commit
message
Slide 36
Slide 36 text
About Commit
Messages
▪ Short description (title)
▪ Long description:
Describe the why's
▪ Reference links
▪ Use proper punctuation!
Voiculescu Bogdan
Slide 37
Slide 37 text
Give Credit Where Credit is Due
Prefix: description
Long description explaining why the changes were made,
why they were made in this way.
What other solutions were considered and rejected
and for what reason.
Reference(s):
• https://....
Co-authored-by: Contributor Name
Slide 38
Slide 38 text
Tools of The Trade
▪ Amend
▪ Interactive Rebase
▪ Cherry picking
Enrica Bressan
Slide 39
Slide 39 text
Cherry Picking
Commits Files Lines
Slide 40
Slide 40 text
Cherry Picking
When
committing
From other
commits
From other
branches
Slide 41
Slide 41 text
K.C. Hohensee
Slide 42
Slide 42 text
To Force Push Or Not To Force Push
DO:
▪ Non-
collaborative
branch,
not pulled
▪ Pulled,
rebased,
no changes
MAYBE
▪ Pulled,
typo/CS fix
DON'T:
▪ Collaborative
branch,
not pulled
▪ Pulled,
review has
started
Slide 43
Slide 43 text
When Things Go
Wrong
Slide 44
Slide 44 text
Reset vs Revert
Slide 45
Slide 45 text
Reset vs Revert
Slide 46
Slide 46 text
Reset vs Revert
Slide 47
Slide 47 text
Reset vs Revert
Slide 48
Slide 48 text
When Things Go
Really Wrong
Slide 49
Slide 49 text
Git Bisect
to the Rescue
Bad
Good
Slide 50
Slide 50 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Slide 51
Slide 51 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Slide 52
Slide 52 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Good or Bad ?
Slide 53
Slide 53 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Good or Bad ?
Slide 54
Slide 54 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Good or Bad ?
Good or Bad ?
Slide 55
Slide 55 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Good or Bad ?
Good or Bad ?
Slide 56
Slide 56 text
Git Bisect
to the Rescue
Bad
Good
Good or Bad ?
Good or Bad ?
Good or Bad ?
Slide 57
Slide 57 text
When Things Go
Really Really REALLY Wrong
Slide 58
Slide 58 text
git reflog
Slide 59
Slide 59 text
Keeping Your
Codebase Clean
Lisandra Barros Mendonça
Slide 60
Slide 60 text
Commit vs Ignore
In repo .gitignore .git/info/exclude
Composer composer.json
composer.lock
/vendor/
composer.lock
NPM package.json /node_modules/
package-lock.json
PHPUnit phpunit.xml.dist phpunit.xml
.phpunit.result.cache
custom-phpunit.xml
IDE of choice /.idea/
OS specific *.bak
.Trashes
[Tt]humbs.db
*.DS_store
Slide 61
Slide 61 text
Keep Distribution Packages Clean
# Exclude these files from release archives.
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
# Auto detect text files and perform LF normalization
* text=auto
# The above will handle all files NOT found below
*.md text
.gitattributes
Slide 62
Slide 62 text
Git in Comfort
Git Kraken SmartGit
Aurees
SourceTree
GitExtensions
CLI
GitEye
Git Cola
Slide 63
Slide 63 text
Thanks!
Any
questions ?
Slides: https://speakerdeck.com/jrf
Feedback: https://joind.in/talk/dafa1
@jrf_nl @jrfnl