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

Git and Github at organizations

Jayesh
August 13, 2013

Git and Github at organizations

Git and Github practices used at Shopsense.

Some of the pointers would be very specific to the business use-case of Shopsense

Jayesh

August 13, 2013
Tweet

More Decks by Jayesh

Other Decks in Technology

Transcript

  1. NOTICE:  Propriety  and  Confiden5al This  material  is  propriety  to  Shopsense.

     IT  contains  trade  secrets  and  confiden5al  informa5on  which  is  sole  propriety  of  Shopsense.  This  material  is  solely  for  Clients  internal  use. This  material  shall  not  be  used,  reproduced,  copied,  disclosed,  transmiBed,  in  whole  or  in  part,  without  the  express  wriBen  consent  of  Shopsense            2013  Shopsense  Retail  Technologies.  All  rights  reserved. www.shopsense.co [email protected] @ShopsenseCo © Development  @  Shopsense From  coding  prac5ces  to  code  management Tuesday, 13 August 13
  2.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © Agenda 2 • Organiza5on • Code  Management • Version  Controlling • Release  Management • Tes5ng • PaBerns • Git  Internals Tuesday, 13 August 13
  3.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © • Team  Account  on  GitHub • Owners • Developers • Designers 3 Organiza5on Tuesday, 13 August 13
  4.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 4 Organiza5on • Team  Account  on  GitHub • Owners • Developers • Designers • Various  Access  privileges Tuesday, 13 August 13
  5.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 5 Organiza5on • Team  Account  on  GitHub • Owners • Developers • Designers • Various  Access  privileges Push,  Pull  &  Administra5on ➜ Push,  Pull ➜ Pull ➜ Tuesday, 13 August 13
  6.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © • ONE  master master 6 Code Management Tuesday, 13 August 13
  7.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © master feature 7 • ONE  master • Extract  feature  branch • feature_feature_name Code Management Tuesday, 13 August 13
  8.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 8 • ONE  master • Extract  feature  branch • feature_feature_name • Code  Review  aka  Pull  Request Code Management master feature pull request Tuesday, 13 August 13
  9.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 9 Code Review • Get  reviewed,  whatever  you  are   pushing • Called  Pull  Request  on  Github • Nothing  should  go  to  master   without  Code  Review master feature pull request Tuesday, 13 August 13
  10.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 10 Code Review • Get  reviewed,  whatever  you  are   pushing • Called  Pull  Request  on  Github • Nothing  should  go  to  master   without  Code  Review master feature pull request Why? • Two  be7er  than  one • Maintain  Hygiene • Maintain  Best  Prac@ces,  Standards Tuesday, 13 August 13
  11.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 11 Code Review • Get  reviewed,  whatever  you  are   pushing • Called  Pull  Request  on  Github • Nothing  should  go  to  master   without  Code  Review Why? • Two  be7er  than  one • Maintain  Hygiene • Maintain  Best  Prac@ces,  Standards master feature pull request Why  Not? • Fault  finding • Revenge Tuesday, 13 August 13
  12.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 12 Code Review • Get  reviewed,  whatever  you  are   pushing • Called  Pull  Request  on  Github • Nothing  should  go  to  master   without  Code  Review Why? • Two  be7er  than  one • Maintain  Hygiene • Maintain  Best  Prac@ces,  Standards master feature pull request Why  Not? • Fault  finding • Revenge End  the  Pull  Request  with  a  :shipit:  emoCcon Tuesday, 13 August 13
  13.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 13 Code Review • Get  reviewed,  whatever  you  are   pushing • Called  Pull  Request  on  Github • Nothing  should  go  to  master   without  Code  Review Why? • Two  be7er  than  one • Maintain  Hygiene • Maintain  Best  Prac@ces,  Standards master feature pull request Why  Not? • Fault  finding • Revenge End  the  Pull  Request  with  a  :shipit:  emoCcon Tuesday, 13 August 13
  14.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 14 master feature pull request fork Code Management Working on hack? Tuesday, 13 August 13
  15.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © • Major.Minor.Revision • Tags  for  Releasable  Versions • Whenever  you  commit  to  master • Log  your  commits  to  change-­‐list • git  log  v0.1.2..HEAD  >>  changelist.log Versioning Tuesday, 13 August 13
  16.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © Automate! 16 Versioning • Major.Minor.Revision • Tags  for  Releasable  Versions • Whenever  you  commit  to  master • Log  your  commits  to  change-­‐list • git  log  v0.1.2..HEAD  >>  changelist.log Tuesday, 13 August 13
  17.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 17 Versioning Rails Change Log Tuesday, 13 August 13
  18.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 18 Release Management • Master  to  staging  every  week • Dog  fooding  -­‐  You  are  the  dev  and  you’re  the  QA! • When  ready  for  produc5on,  tag  master  to  a  release • GitHub  Releases  maps  a  release  to  a  git  tag Tuesday, 13 August 13
  19.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 19 Testing • UNIT  TesCng • Integra5on  Tes5ng • Travis  CI • Always  be  Tes5ng!  :) Tuesday, 13 August 13
  20.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 20 when do ..  you  are  working  on  a  branch  and  you  see  something  broken  in   master ..  commit/stash  changes  in  your  current  branch  ‘b’,  create  a  new   branch  from  master  ‘n’.  Fix  bug,  raise  PR.  When  ‘n’  is  merged  in   master,  rebase  ‘b’ ..  you  are  working  on  a  branch  ‘a’  but  cannot  merge  it  right     now.  But  you  want  to  work  on  a  feature  that  relies  on  changes  in   branch  ‘a’.   ..  create  a  branch  ‘b’  from  ‘a’.  Once  ‘a’  is  merged  into  master,   rebase  ‘b’  against  master.  Resolve  conflicts  (an5cipate  many  of   them) ..  you  are  making  some  changes  which  you  think  doesn’t  really   need  a  PR.  For  example;  indenta5on  or  spelling  error  fix   ..  create  a  PR,  assign  it  to  yourself,  make  a  comment  and  close  it   yourself. ..  you  want  to  prototype  and  get  feedback  on  your  idea ..  clone  the  repo,  make  branches,  perfect  the  code,  test  it  and   submit  a  PR Best Practices Tuesday, 13 August 13
  21.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 21 Git internals Tuesday, 13 August 13
  22.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 22 What  is  Git? • ...  is  a  database • .git  folder Tuesday, 13 August 13
  23.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 23 What  is  Git? .git Files Objects Refs Hooks Info Tuesday, 13 August 13
  24.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 24 What  is  Git? .git Files Objects Refs Hooks Info Tuesday, 13 August 13
  25.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 25 What  is  Git? .git Files Objects Refs Hooks Info Metadata Tree Blob Tuesday, 13 August 13
  26.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 26 What  is  Git? .git Files Objects Refs Hooks Info Metadata Tree Blob Tree Blob Tuesday, 13 August 13
  27.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 27 What  is  Git? .git Files Objects Refs Hooks Info Metadata Tree Blob Tree Blob Tree Blob Tuesday, 13 August 13
  28.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 28 lib compute.py math calculus.py matrix.py How Git works? Without commit Tuesday, 13 August 13
  29.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 29 lib compute.py math calculus.py matrix.py Blob Tree Blob Blob Tree Commit How Git works? At commit Tuesday, 13 August 13
  30.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 30 lib compute.py math calculus.py matrix.py Blob Tree Blob Blob HEAD BRANCH Tree Commit How Git works? At commit Tuesday, 13 August 13
  31.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 31 lib compute.py math calculus.py matrix.py Blob Tree Blob Blob HEAD BRANCH Tree Commit How Git works? You make changes Tuesday, 13 August 13
  32.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 32 Blob Tree Blob Blob Tree Commit Tree Commit Blob Tree Blob lib compute.py math calculus.py matrix.py How Git works? New commit object Tuesday, 13 August 13
  33.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 33 Blob Tree Blob Blob Tree Commit Tree Commit HEAD BRANCH Blob Tree Blob lib compute.py math calculus.py matrix.py How  Git  Works? Tuesday, 13 August 13
  34.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 34 Blob Tree Blob Blob Tree Commit Tree Commit HEAD BRANCH Blob Tree Tag Blob lib compute.py math calculus.py matrix.py How  Git  Works? Tuesday, 13 August 13
  35.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 35 Git local-­‐staging-­‐produc=on Tuesday, 13 August 13
  36.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 36 Staging Local  Git   DB Working Directory REMOTE git  add git  commit git  push  origin  .. git  pull  /  fetch git  checkout  /  merge How  Git  works? Local-­‐Staging-­‐Produc5on Tuesday, 13 August 13
  37.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 37 Git (cheap)  branching Tuesday, 13 August 13
  38.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 38 C0 MASTER How  Git  Works Branch  Traversal Tuesday, 13 August 13
  39.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 39 C0 MASTER C1 How  Git  Works Branch  Traversal Tuesday, 13 August 13
  40.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 40 C0 MASTER C1 C2 BRANCH How  Git  Works Branch  Traversal Tuesday, 13 August 13
  41.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 41 C0 C1 C2 C3 BRANCH MASTER How  Git  Works Branch  Traversal Tuesday, 13 August 13
  42.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 42 C0 C1 C2 C3 C4 BRANCH MASTER How  Git  Works Branch  Traversal Tuesday, 13 August 13
  43.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 43 C0 C1 C2 C3 C4 BRANCH C5 MASTER How  Git  Works Branch  Traversal Tuesday, 13 August 13
  44.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 44 C0 C1 C2 C3 C4 BRANCH MASTER C5 C6 How  Git  Works Branch  Traversal Tuesday, 13 August 13
  45.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 45 C0 C1 C2 C3 C4 BRANCH MASTER C5 C6 How  Git  Works Branch  Traversal Tuesday, 13 August 13
  46.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 46 Explore Future  Endeavors • Travis  CI • Hubot Tuesday, 13 August 13
  47.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © References 47 • h7p://zachholman.com/talk/how-­‐github-­‐uses-­‐github-­‐to-­‐build-­‐github/ • h7p://git-­‐scm.com/book/en/Git-­‐Internals Tuesday, 13 August 13
  48.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © Coding  Style  Guide 48 Python h7p://www.python.org/dev/peps/pep-­‐0008/ R h7p://google-­‐styleguide.googlecode.com/svn/trunk/Rguide.xml ObjecCve  C h7p://google-­‐styleguide.googlecode.com/svn/trunk/objcguide.xml JavaScript h7p://google-­‐styleguide.googlecode.com/svn/trunk/javascriptguide.xml CPP h7p://google-­‐styleguide.googlecode.com/svn/trunk/cppguide.xml C h7p://www.maultech.com/chrislo7/resources/cstyle/Peter_CStyleGuide.pdf C#  /  Java h7p://www.shopsense.co/wiki/index.php?@tle=User_talk:Rajat Tuesday, 13 August 13
  49.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © Editors  and  IDE’s  and  Tools 49 Python Aptana SCM Git,  GitHub Database MySQL,  SQLite Database  Client Sequel  Pro,  SQL  Yogi StaCsCcs R HTML  /  JS  /  CSS Aptana C# Visual  Studio ObjecCve  C XCode Java Eclipse C  /  C++ Netbeans QT QT  Editor Tuesday, 13 August 13
  50.      2013  Shopsense  Retail  Technologies.  Confiden5al  document,  not  for

     circula5on.  All  rights  reserved © 50 Ques@ons? We’re  hiring Email  us  at  [email protected] Tuesday, 13 August 13