Slide 1

Slide 1 text

git educated about git by Jeremy Lindblom ( @jeremeamia )

Slide 2

Slide 2 text

git what? • why? • how?

Slide 3

Slide 3 text

git

Slide 4

Slide 4 text

hello! i'm jeremy.

Slide 5

Slide 5 text

hello! i'm jeremy. PHP Software Engineer at Co-author of the AWS SDK for PHP Co-organizer of the Seattle PHP User Group Zend Education Advisory Board for 5.5 exam Keys/Vocals for Gigawattband.com @jeremeamia on and | webjeremy.com

Slide 6

Slide 6 text

raise your hand if… 1.  You've used git. a.  …but only via a GUI. 2.  You've used SVN, CVS, P4, etc. 3.  You've never used a VCS. 4.  You have a GitHub account. a.  …and actually have repos you've created. 5.  You came to learn more about git. 6.  You just came to hear the song.

Slide 7

Slide 7 text

git what is (g)it?

Slide 8

Slide 8 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 9

Slide 9 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 10

Slide 10 text

version control •  Also source control or revision control •  “any practice that tracks and provides control over changes to source code”[1] •  Version Control System ( VCS ) – Git – SVN – CVS – Mercurial – Perforce – ClearCase – SourceSafe – Bazaar – TFS

Slide 11

Slide 11 text

vocabulary – part 1 •  Repository | Repo – Set of current & past data about the files •  Revision | Version | Commit – A tracked change to the repo •  Working Copy – Local copy of the repo at a specific revision •  Head | Tip – The most recent revision

Slide 12

Slide 12 text

vocabulary – part 2 •  Trunk | Mainline | Master – The main development path of the repo •  Branch – A divergent development path of the repo for features, fixes, etc. •  Merge – Integrate revisions from a branch back into trunk or other branch •  Tag – A name or label given to a revision

Slide 13

Slide 13 text

snapshots, not deltas [2]

Slide 14

Slide 14 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 15

Slide 15 text

who is using git?

Slide 16

Slide 16 text

who is using git? https://github.com/aws

Slide 17

Slide 17 text

who is using git? Zend Framework • Symfony • Laravel Doctrine • Guzzle • CodeIgniter • Monolog WordPress • CakePHP AWS SDK for PHP • Yii Composer • Magento PHPUnit • hhvm • Slim Drupal • FuelPHP • Kohana • Joomla Silex • PHPParser • Aura • Assetic • phpBB Phalcon • phpDocumentor • PyroCMS

Slide 18

Slide 18 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 19

Slide 19 text

centralized version control [3]

Slide 20

Slide 20 text

distributed version control [3]

Slide 21

Slide 21 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 22

Slide 22 text

what is git? 1. It's a version control system. 2. It's really popular. 3. It's distributed. 4. It's fast. 5. It's FOSS.

Slide 23

Slide 23 text

git why should you use (g)it?

Slide 24

Slide 24 text

so you can… …continue being employable. …contribute to open source projects. …put code on your GitHub profile. …deploy code to PaaS solutions. …use Composer effectively. …ditch SVN, CVS, P4, etc.

Slide 25

Slide 25 text

git how do you use (g)it?

Slide 26

Slide 26 text

20 essential commands 1.    git  help   2.    git  config   3.    git  init   4.    git  status   5.    git  add   6.    git  rm  -­‐-­‐cached   7.    git  commit   8.    git  diff   9.    git  reset   10.  git  log       11.  git  remote   12.  git  push   13.  git  clone 14.  git  pull   15.  git  fetch   16.  git  branch   17.  git  checkout   18.  git  merge   19.  git  tag   20.  git  push  -­‐-­‐tags  

Slide 27

Slide 27 text

#1. git help $  git  help   usage:  git  [-­‐-­‐version]  [-­‐-­‐exec-­‐path[=]]  [-­‐-­‐html-­‐pat                        [-­‐p|-­‐-­‐paginate|-­‐-­‐no-­‐pager]  [-­‐-­‐no-­‐replace-­‐objec                        [-­‐-­‐git-­‐dir=]  [-­‐-­‐work-­‐tree=]  [-­‐-­‐nam                        [-­‐c  name=value]  [-­‐-­‐help]                          []     $  git  help  init                                                                     NAME                git-­‐config  -­‐  Get  and  set  repository  or  global  opti   SYNOPSIS                  git  config  []  [type]  [-­‐z|-­‐-­‐null]  nam  

Slide 28

Slide 28 text

#2. git config $  git  config  -­‐-­‐global  user.name  "Jeremy  Lindblom"   $  git  config  -­‐-­‐global  user.email  [email protected]     $  git  config  user.name   Jeremy  Lindblom   $  git  config  user.email   [email protected]  

Slide 29

Slide 29 text

#3. git init $  mkdir  git-­‐test   $  cd  git-­‐test   $  ls  -­‐a   .        ..   $  git  init   Initialized  empty  Git  repository  in  ~/git-­‐test/.git/   $  ls  -­‐a   .        ..      .git   $  ls  -­‐a  .git   .                      HEAD                config            hooks              objects   ..                    branches        description  info                refs  

Slide 30

Slide 30 text

#4. git status $  git  status   #  On  branch  master   #   #  Initial  commit   #   nothing  to  commit  (create/copy  files  and  use  "git  add"  to   track)  

Slide 31

Slide 31 text

making changes

Slide 32

Slide 32 text

making changes ..."  to  include  in  commit)   #  README.md   #  index.php   nothing  added  to  commit  but  untracked  files  present  (use   "git  add"  to  track)   #  Git  Test     index.php README.md

Slide 33

Slide 33 text

#5. git add $  git  add  index.php   $  git  add  README.md     $  git  status   #  On  branch  master   #  Initial  commit   #  Changes  to  be  committed:   #      (use  "git  rm  -­‐-­‐cached  ..."  to  unstage)   #   #  new  file:      index.php   #  new  file:      README.md   #  

Slide 34

Slide 34 text

#6. git rm --cached $  git  rm  -­‐-­‐cached  README.md   $  git  status   #  On  branch  master   #  Initial  commit   #  Changes  to  be  committed:   #      (use  "git  rm  -­‐-­‐cached  ..."  to  unstage)   #  new  file:      index.php   #   #  Untracked  files:   #      (use  "git  add  ..."  to  include  in  commit)   #  README.md  

Slide 35

Slide 35 text

#7. git commit $  git  add  .   $  git  commit  -­‐m  "Added  index  and  README"   [master  (root-­‐commit)  3ea3f8f]  Added  index  and  README    2  files  changed,  8  insertions(+),  0  deletions(-­‐)    create  mode  100644  README.md    create  mode  100644  index.php   $  git  status   #  On  branch  master   nothing  to  commit  (working  directory  clean)  

Slide 36

Slide 36 text

#8. git diff $  git  diff   diff  -­‐-­‐git  a/README.md  b/README.md   index  fdd135c..5152172  100644   -­‐-­‐-­‐  a/README.md   +++  b/README.md   @@  -­‐1,4  +1,4  @@    #  Git  Test       -­‐Testing  out  git.   +Testing  out  git.  It's  not  too  hard.  

Slide 37

Slide 37 text

#9. git reset $  git  status   #  On  branch  master   #  Changes  not  staged  for  commit:   #      (use  "git  add  ..."  to  update  for  commit)   #      (use  "git  checkout  -­‐-­‐  ..."  to  discard  changes)   #   #  modified:      README.md   #   no  changes  added  to  commit  (use  "git  add)     $  git  reset  -­‐-­‐hard   HEAD  is  now  at  fdd135c  Added  index  and  README  

Slide 38

Slide 38 text

#10. git log $  git  log   fdd135cd6e09efd9c0b1b30387c2d555  Added  index  and  README   0190a93b810f5084fa3a85afc54cf0d6  Initial  commit  

Slide 39

Slide 39 text

we're still local! $  git  log   fdd135cd6e09efd9c0b1b30387c2d555  Added  index  and  README   0190a93b810f5084fa3a85afc54cf0d6  Initial  commit  

Slide 40

Slide 40 text

20 essential commands 1.    git  help   2.    git  config   3.    git  init   4.    git  status   5.    git  add   6.    git  rm  -­‐-­‐cached   7.    git  commit   8.    git  diff   9.    git  reset   10.  git  log       11.  git  remote   12.  git  push   13.  git  clone 14.  git  pull   15.  git  fetch   16.  git  branch   17.  git  checkout   18.  git  merge   19.  git  tag   20.  git  push  -­‐-­‐tags  

Slide 41

Slide 41 text

#11. git remote $  git  remote  add  origin  [email protected]:vendor/project.git   $  git  remote  -­‐-­‐verbose   origin  [email protected]:vendor/project.git  (fetch)   origin  [email protected]:vendor/project.git  (push)  

Slide 42

Slide 42 text

workflow for changes Local

Slide 43

Slide 43 text

#12. git push $  git  push  origin  master   Counting  objects:  6,  done.   Delta  compression  using  up  to  4  threads.   Compressing  objects:  100%  (2/2),  done.   Writing  objects:  100%  (4/4),  432  bytes,  done.   Total  4  (delta  0),  reused  0  (delta  0)   To  [email protected]:vendor/project.git        0190a93..fdd135c    master  -­‐>  master  

Slide 44

Slide 44 text

#13. git clone $  cd  ../   $  rm  -­‐rf  git-­‐test/   $  git  clone  [email protected]:jeremeamia/git-­‐test.git   Cloning  into  'git-­‐test'...   remote:  Counting  objects:  9,  done.   remote:  Compressing  objects:  100%  (6/6),  done.   remote:  Total  9  (delta  1),  reused  4  (delta  0)   Receiving  objects:  100%  (9/9),  done.   Resolving  deltas:  100%  (1/1),  done.   $  cd  git-­‐test  

Slide 45

Slide 45 text

#14. git pull $  git  pull  origin  master   From  github.com:jeremeamia/git-­‐test    *  branch                        master          -­‐>  FETCH_HEAD   Current  branch  master  is  up  to  date.  

Slide 46

Slide 46 text

#15. git fetch $  git  fetch  origin     git  pull vs. git  fetch  

Slide 47

Slide 47 text

#16. git branch $  git  branch  improve-­‐readme   $  git  branch      improve-­‐readme   *  master  

Slide 48

Slide 48 text

#17. git checkout $  git  checkout  improve-­‐readme   Switched  to  branch  'improve-­‐readme'   $  git  branch   *  improve-­‐readme      master  

Slide 49

Slide 49 text

#18. git merge $  vim  README.md     $  git  add  .   $  git  commit  -­‐m  "Improved  the  README"   [improve-­‐readme  749305e]  Improved  the  README    1  files  changed,  2  insertions(+),  0  deletions(-­‐)   $  git  checkout  master   Switched  to  branch  'master'   $  git  merge  improve-­‐readme   Updating  fdd135c..749305e   Fast-­‐forward    README.md  |        2  ++    1  files  changed,  2  insertions(+),  0  deletions(-­‐)  

Slide 50

Slide 50 text

#19. git tag $  git  tag  v1.0.0   $  git  tag   v1.0.0   http://semver.org/  

Slide 51

Slide 51 text

#20. git push --tags $  git  push  -­‐-­‐tags  origin  master   Counting  objects:  5,  done.   Delta  compression  using  up  to  4  threads.   Compressing  objects:  100%  (3/3),  done.   Writing  objects:  100%  (3/3),  328  bytes,  done.   Total  3  (delta  1),  reused  0  (delta  0)   To  [email protected]:jeremeamia/git-­‐test.git        fdd135c..749305e    master  -­‐>  master    *  [new  tag]                  1.0.0  -­‐>  1.0.0  

Slide 52

Slide 52 text

congratulations! 1.    git  help   2.    git  config   3.    git  init   4.    git  status   5.    git  add   6.    git  rm  -­‐-­‐cached   7.    git  commit   8.    git  diff   9.    git  reset   10.  git  log       11.  git  remote   12.  git  push   13.  git  clone 14.  git  pull   15.  git  fetch   16.  git  branch   17.  git  checkout   18.  git  merge   19.  git  tag   20.  git  push  -­‐-­‐tags  

Slide 53

Slide 53 text

commands summary Starting: Changing: Status: Syncing: Branching: Releasing: init,  clone,  config   add,  commit,  status,  reset,  rm   push,  pull,  fetch,  remote   branch,  merge,  checkout   tag,  push  -­‐-­‐tags   status,  diff,  log  

Slide 54

Slide 54 text

“You’re Doin’ Git!” By Jeremy Lindblom ♫ ♬   ♫ ♫ ♬   ♬  

Slide 55

Slide 55 text

git  help,  config,  and  init.     remote,  fetch,  pull,  let's  edit.   diff,  add,  status,  commit.  you're  doin'  git.     log,  branch,  checkout,  that's  it!   checkout,  merge,  rebase,  don't  quit.   clean,  reset,  tag,  push  those  bits!  you're  doin'  git!     fork  and  clone  all  the  repos  you  know,   patches  and  pull  requests,  you'll  steal  the  git  show.   you're  doin'  git.  you're  doing  it!   check  git  blame  and  see  your  username.   hope  you  ran  the  tests  before  your  commit,   or  other  devs  will  think  you're  an  idiot.   you're  doin'  git.  (x4)     You're  Doin'  Git!   ©2013  Jeremy  Lindblom  

Slide 56

Slide 56 text

git — tools —

Slide 57

Slide 57 text

git hosting Third-party hosting •  GitHub •  Bitbucket •  SourceForge •  Gitorious •  Google Code •  CodePlex Self-hosting •  Git •  Gitolite •  Gitosis

Slide 58

Slide 58 text

git guis •  git-gui + gitk •  GitHub (web / Mac / Windows) •  Tower •  GitBox •  SourceTree •  TortoiseGit •  Your IDE

Slide 59

Slide 59 text

git — workflows —

Slide 60

Slide 60 text

popular workflows •  git-flow – http://nvie.com/posts/a-successful-git- branching-model/ •  Github Flow – http://scottchacon.com/2011/08/31/ github-flow.html

Slide 61

Slide 61 text

git-flow [4]

Slide 62

Slide 62 text

multiple remotes AWS  SDK  for  PHP   AWS SDK for PHP

Slide 63

Slide 63 text

custom workflows AWS SDK for PHP

Slide 64

Slide 64 text

[5]

Slide 65

Slide 65 text

github features •  Awesome web interface •  Encourages collaboration •  Issue and milestone trackers •  Wikis, project pages, organizations •  Comments and code reviews •  Forking and Pull Requests (PRs)

Slide 66

Slide 66 text

git what? • why? • how?

Slide 67

Slide 67 text

git why? how? what? A fast, distributed, fun, popular, & free VCS. To be employable & a good OSS contributor. Learn the CLI & tools. Create lots of branches.

Slide 68

Slide 68 text

git educated about git by Jeremy Lindblom ( @jeremeamia ) Thanks! Questions? Rate on Joind.in: https://joind.in/10519

Slide 69

Slide 69 text

git tutorials •  http://try.github.io/ •  http://book.git-scm.com/ •  http://progit.org/book/ •  http://gitimmersion.com/ •  http://githowto.com/ •  http://gitref.org/ •  http://gitready.com/

Slide 70

Slide 70 text

references 1.  http://en.wikipedia.org/wiki/ Revision_control 2.  http://git-scm.com/book/ch1-3.html 3.  http://git-scm.com/book/en/Getting- Started-About-Version-Control 4.  http://nvie.com/posts/a-successful-git- branching-model/ 5.  https://github.com/aws/aws-sdk-php