Slide 1

Slide 1 text

git basics! Marvin  Killing   Co-­‐founder,  PlaytestCloud   Git  Aficionados,  2013-­‐12-­‐13  

Slide 2

Slide 2 text

Blobs! Trees! Commits!

Slide 3

Slide 3 text

If you change anything about an object, it’s not the same object anymore.! 
 It becomes a new object.! SHA1! a3768903ca03f7cccb3c6b6f474f88f8e9a3bb5b

Slide 4

Slide 4 text

commit! hello.txt A3768903ca03f7cc... 97b49d4c943e3715fe30f141cc6f27a8548cee0e a3768903ca03f7cccb3c6b6f474f88f8e9a3bb5b Hello World tree 97b49d4c943e3715f...   initial msg: a3768903ca03f7cccb3c6b6f474f88f8e9a3bb5b Tree! Blob!

Slide 5

Slide 5 text

parents! initial msg: commit 2 msg: commit 3 msg:

Slide 6

Slide 6 text

a3768903 initial msg: commit 2 msg: commit 3 msg: master branch! ca03f7cc cb3c6b6d

Slide 7

Slide 7 text

commit 2 msg: commit 3 msg: master branch1 initial msg: $ git branch branch1 HEAD

Slide 8

Slide 8 text

a5d743   initial msg: commit 2 msg: Feature A msg: master Feature B msg: branch1 HEAD $ git checkout branch1 $ git checkout a5d743 You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.  

Slide 9

Slide 9 text

commit 2 msg: Feature A msg: Feature B msg: branch_b merge branch_b msg: master HEAD $ git merge branch_b

Slide 10

Slide 10 text

initial msg: commit 2 msg: Feature B msg: branch_b fast-forward! master HEAD $ git merge branch_b

Slide 11

Slide 11 text

initial msg: commit 2 msg: commit 3 msg: master HEAD $ git reset --hard HEAD^ a3768903 ca03f7cc cb3c6b6d

Slide 12

Slide 12 text

initial msg: commit 2 msg: commit 3 msg: master HEAD $ git reset --hard

Slide 13

Slide 13 text

collabo! ration!

Slide 14

Slide 14 text

alice commit1 commit2 commit a master bob commit1 commit2 commit a master origin commit1 commit2 commit a master

Slide 15

Slide 15 text

alice commit1 commit2 commit a master commit b bob commit1 commit2 commit a master commit1 commit2 commit a master alice$ git push origin master commit b origin

Slide 16

Slide 16 text

alice commit1 commit2 commit a master commit b bob commit1 commit2 commit a master origin commit1 commit2 commit a master commit b commit b bob$ git fetch origin/master

Slide 17

Slide 17 text

alice commit1 commit2 commit a master commit b bob commit1 commit2 commit a master commit1 commit2 commit a master commit b commit b origin/master bob$ git fetch bob$ git merge origin/master

Slide 18

Slide 18 text

git pull git fetch git merge =! +!

Slide 19

Slide 19 text

alice commit1 commit2 commit a master bob commit1 commit2 commit a master origin commit1 commit2 commit a master Feature B Feature B Feature A Feature B origin/master merge origin/master Feature A merge origin/master fetch merge origin/master push 6c699cb..04872e1 master -> master

Slide 20

Slide 20 text

John  McDonnell:  Git  for  computer  scienEsts    hFp://nyuccl.org/pages/GitTutorial/     resources! ScoF  Chacon:  Pro  Git          hFp://www.git-­‐scm.com/book   LearnGitBranching          hFp://pcoFle.github.io/learnGitBranching/  

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

pro features!

Slide 23

Slide 23 text

staging area!

Slide 24

Slide 24 text

rebase!

Slide 25

Slide 25 text

git commit -- amend!

Slide 26

Slide 26 text

refspecs!

Slide 27

Slide 27 text

cherry-pick!

Slide 28

Slide 28 text

add -p!

Slide 29

Slide 29 text

aliases!

Slide 30

Slide 30 text

git lol!

Slide 31

Slide 31 text

shell extensions

Slide 32

Slide 32 text

Blob! a3768903ca03f7cccb3c6b6f474f88f8e9a3bb5b Hello World

Slide 33

Slide 33 text

Tree! hello.txt A3768903ca03f7cc... 97b49d4c943e3715fe30f141cc6f27a8548cee0e a3768903ca03f7cccb3c6b6f474f88f8e9a3bb5b Hello World

Slide 34

Slide 34 text

.gitignore! # Untracked files: # (use "git add ..." to include in what will be committed) # # .DS_Store # config/database.yml # log/