Slide 1

Slide 1 text

GIT YOUR ACT TOGETHER.

Slide 2

Slide 2 text

SO, WHAT DO I KNOW? ‣ Hi, I’m Roy Tomeij ‣ Co-founder 80beans ‣ Front-end since 1998 ‣ Version control since 2004 ‣ Git since 2008

Slide 3

Slide 3 text

DISCLAIMER: GIT TALKS ARE HARD.

Slide 4

Slide 4 text

YOU NEED VERSIONING.

Slide 5

Slide 5 text

Why version control? ‣ Have a backup. ‣ Revert code. ‣ Have multiple branches. ‣ Know your history. ‣ Work with a team.

Slide 6

Slide 6 text

GIT IS DIFFERENT.

Slide 7

Slide 7 text

How is Git different from SVN? ‣ Distributed instead of centralized. ‣ Snapshots instead of differences. ‣ Hash instead of revision number. ‣ Ignoring files is intuitive. ‣ No friggin’ .svn directories.

Slide 8

Slide 8 text

Distribution.

Slide 9

Slide 9 text

Differences vs snapshots. SVN below.

Slide 10

Slide 10 text

Snapshots vs differences. Git below.

Slide 11

Slide 11 text

GIT ONLY ADDS DATA.

Slide 12

Slide 12 text

SO, HOW DOES IT WORK?

Slide 13

Slide 13 text

Anatomy & file status.

Slide 14

Slide 14 text

Pull, push & merge.

Slide 15

Slide 15 text

Branches. ‣ Great way to work on multiple features, versions, etc. ‣ Git knows which commits belong to which branch. ‣ Default branch is “master”.

Slide 16

Slide 16 text

A branching example.

Slide 17

Slide 17 text

A branching example. $ git checkout -b iss53 Switched to a new branch "iss53"

Slide 18

Slide 18 text

A branching example. $ nano index.html $ git commit -am 'Add a new footer'

Slide 19

Slide 19 text

A branching example. $ Make some changes in “master” and “iss53”.

Slide 20

Slide 20 text

A branching example. $ git checkout master $ git merge iss53

Slide 21

Slide 21 text

KEEP IT CLEAN.

Slide 22

Slide 22 text

Keep your log clean. ‣ Write proper commit messages. ‣ Commit everything separately. ‣ Use “git pull --rebase”. ‣ Use “git commit --amend” to fix your list commit (message).

Slide 23

Slide 23 text

TIME TO GET ORGANIZED.

Slide 24

Slide 24 text

Git Flow: a branching model. ‣ http://github.com/nvie/gitflow ‣ Manages features, hotfixes, etc.

Slide 25

Slide 25 text

QUALITY IS KING.

Slide 26

Slide 26 text

GitHub. ‣ Free public repositories. ‣ Contribute to open source projects. ‣ Fork and build upon existing code.

Slide 27

Slide 27 text

GitHub Pull Requests. ‣ Create a branch for each feature. ‣ When done, create a pull request. ‣ Have others peer review. ‣ Merge into your master branch.

Slide 28

Slide 28 text

Time left? ‣ git blame ‣ git add -p ‣ git rebase -i ‣ git cherry-pick ‣ git bisect

Slide 29

Slide 29 text

QUESTIONS?

Slide 30

Slide 30 text

Acknowledgements. ‣ Some images taken from http://progit.org/.