Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Class 3: Cathedral/Bazaar Discussion and Git Branching

Class 3: Cathedral/Bazaar Discussion and Git Branching

Notes for 5/23/2013

Ian Luke Kane

May 23, 2013
Tweet

More Decks by Ian Luke Kane

Other Decks in Technology

Transcript

  1. The  Cathedral  and  the  Bazaar   Discussion •What  are  some

     of  the  differences  between  cathedral   and  bazaar  development  styles? •Why  did  Eric  Raymond  start  working  on  this  mail   program  in  the  first  place? •What’s  the  dis?nc?on  in  coding  between  original   crea?ons  and  code  reuse? •In  his  opinion,  why  is  it  important  to  “release  early  and   release  oDen”? •Why  are  “customers”  (or  users)  important?
  2. Git  Commands   •  git  init •Ini%alize  a  repository  in

     an  exis%ng  directory •Creates  a  repository  skeleton •  git  clone  [url] •Cloning  an  exis%ng  repository •Remember  that  each  file  in  your  working  directory  can  be  in  one  of  two   states:  tracked  or  untracked.  Tracked  files  are  files  that  were  in  the  last   snapshot;  they  can  be  unmodified,  modified,  or  staged.  Untracked  files  are   everything  else  —  any  files  in  your  working  directory  that  were  not  in  your   last  snapshot  and  are  not  in  your  staging  area.  When  you  first  clone  a   repository,  all  of  your  files  will  be  tracked  and  unmodified  because  you  just   checked  them  out  and  haven’t  edited  anything. 3
  3. Git  Commands   •  git  status •Check  the  status  of

     your  files •  git  add  [file  name] •To  begin  tracking  a  new  file.  If  it's  a  folder,  all  files  are  added   recursively  you  use  it  to  begin  tracking  new  files,  to  stage  files,   and  to  do  other  things  like  marking  merge-­‐conflicted  files  as   resolved •git  diff •What  have  you  changed  but  not  yet  staged?  And  what  have  you   staged  that  you  are  about  to  commit?  git  diff  shows  you  the   exact  lines  added  and  removed  —  the  patch,  as  it  were. 5
  4. Wait,  Staged  AND  Unstaged? $  vim  benchmarks.rb $  git  status

    #  On  branch  master #  Changes  to  be  commiPed: #      (use  "git  reset  HEAD  <file>..."  to  unstage) # #      new  file:      README #      modified:      benchmarks.rb # #  Changes  not  staged  for  commit: #      (use  "git  add  <file>..."  to  update  what  will  be  commiPed) # #      modified:      benchmarks.rb # 6
  5. Git  Commands   •  git  commit •Remember  that  anything  that

     is  s%ll  unstaged  —  any  files  you   have  created  or  modified  that  you  haven’t  run  git  add  on  since   you  edited  them  —  won’t  go  into  this  commit. •You  can  type  your  commit  message  inline  with   the  commit  command  by  specifying  it  aPer  a  -­‐m  flag,  like  this: •git  commit  -­‐m  "Story  182:  Fix  benchmarks  for  speed" •Skipping  the  staging  area  (skip  the  git  add  part):   •git  commit  -­‐a  -­‐m  'added  new  benchmarks' 7
  6. Git  Commands   •  git  rmv •To  remove  a  file

     from  Git,  you  have  to  remove  it  from  your   tracked  files  (more  accurately,  remove  it  from  your  staging  area)   and  then  commit.  The  git  rm  command  does  that  and  also   removes  the  file  from  your  working  directory  so  you  don’t  see  it   as  an  untracked  file  next  %me  around. •  git  log •View  the  commit  history.  Lots  of  switches  available. •git  log  -­‐p:  Shows  the  diff  introduced •Using  gitk  as  a  visual  git  log  tool 8
  7. Git  Branching •Git’s  “killer  feature” •Branching  means  you  diverge  from

     the  main  line  of   development  and  con?nue  to  do  work  without  messing   with  that  main  line •The  way  Git  branches  is  incredibly  lightweight,  making   branching  opera?ons  nearly  instantaneous  and   switching  back  and  forth  between  branches  generally   just  as  fast. •Visual  tutorial:   • Check  out  the  Learn  Git  Branching  Tutorial! • PrimeSieve.sql  Example 9