Slide 1

Slide 1 text

Git I'm lovin' it!

Slide 2

Slide 2 text

My University Life

Slide 3

Slide 3 text

Introducing... Version Control ● What changed? ● Who changed? ● When did it change? ● Why did it change?

Slide 4

Slide 4 text

Traditional Version Control ● SLOW ● COMPLICATED to branch ● Branches are COPIES ● Merging is ANNOYING ● SLOW ● Not always free ● Requires a centralized server ● Can't always work offline A new world of PAIN

Slide 5

Slide 5 text

Why you should love git

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

Git == AWESOME ● FAST ● Developers can work offline ● Local Control ● Much smaller compared to other repos, e.g: Mozilla (SVN), 30x smaller ● Branches carry their entire history ● DECENTRALIZED ● ANY workflow is possible

Slide 8

Slide 8 text

How fast? Source: http://git-scm.com/about/small-and-fast pretty fast...

Slide 9

Slide 9 text

Getting Started

Slide 10

Slide 10 text

git config --global user.email git config --global user.name * sometimes, git config --local

Slide 11

Slide 11 text

git init 8:45 ➜ restaurant> git init Initialized empty Git repository in /Users/amirf/restaurant/.git/ 8:45 ➜ restaurant git:(master) ✗> Master is not special, it's just the default.

Slide 12

Slide 12 text

git clone 8:45 ➜ git clone [email protected]:funky-repo.git

Slide 13

Slide 13 text

3 types of files

Slide 14

Slide 14 text

untracked and not staged

Slide 15

Slide 15 text

staged

Slide 16

Slide 16 text

committed (added)

Slide 17

Slide 17 text

git add --all git add . git add

Slide 18

Slide 18 text

git status 8:52 ➜ restaurant git:(master) ✗ git status # On branch master # *snip snip* # # new file: rest_task1.c # 8:54 ➜ restaurant git:(master) ✗

Slide 19

Slide 19 text

git commit also - git commit -m change last message - git commit --amend

Slide 20

Slide 20 text

What is a commit? a 40 digits b107591703f6e5c767ee6bc34c3b19000672be8f SHA

Slide 21

Slide 21 text

git push git push origin 8:45 ➜ git push origin master

Slide 22

Slide 22 text

What is HEAD? A reference to the last commit in the current branch

Slide 23

Slide 23 text

git pull git pull origin 9:45 ➜ git pull origin master

Slide 24

Slide 24 text

Basic Training Complete!

Slide 25

Slide 25 text

BRANCHING

Slide 26

Slide 26 text

git branch 9:45 ➜ git branch new-feature

Slide 27

Slide 27 text

What is a branch? A reference to the head of work somewhere

Slide 28

Slide 28 text

git checkout 9:45 ➜ git checkout new-feature Switched to branch new-feature

Slide 29

Slide 29 text

git checkout -b Actually wraps: git branch git checkout

Slide 30

Slide 30 text

git log [-p]

Slide 31

Slide 31 text

git diff

Slide 32

Slide 32 text

git merge 9:45 git:(master) ➜ git merge new-feature 9:45 git:(master) ➜ git merge remotes/origin/new-feature

Slide 33

Slide 33 text

git stash ➜ git stash save ➜ git stash list ➜ git stash pop ➜ git stash apply stash@{0} ➜ git stash drop stash@{0} the 'stash

Slide 34

Slide 34 text

git cherry-pick

Slide 35

Slide 35 text

git blame

Slide 36

Slide 36 text

git reset --hard git reset --soft

Slide 37

Slide 37 text

DEMO TIME! Let's create a repository and do some branching, merging and revet. ...and then let's do it on plugins-repo.

Slide 38

Slide 38 text

There's more Much, more. clean, fetch, tag, describe, rebase, stash, revert - and many, many more.

Slide 39

Slide 39 text

To summerize

Slide 40

Slide 40 text

Resources Google. Thanks!