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

Advanced Git

Advanced Git

Talk at the #TechTalks at Sixt

Enrique López Mañas

December 03, 2014
Tweet

More Decks by Enrique López Mañas

Other Decks in Technology

Transcript

  1. Advanced Git München,  3.12.2014   Because  there  is  life  

    behind  pull  and  commit!             Enrique  López-­‐Mañas  
  2. Index   •  Merging  and  rebasing   •  ReseGng,  checking

     out  and  reverJng   •  Advanced  git  log   •  Hooks  
  3. Merge  and  rebasing   git  checkout  feature   git  merge

     master       git  merge  master  feature    
  4. Merge  and  rebasing   git  checkout  feature   git  merge

     master       git  merge  master  feature    
  5. Merge  and  rebasing   InteracJve  rebasing     git  checkout

     feature   git  rebase  -­‐i  master     pick  33d5b7a  Message  for  commit  #1   pick  9480b3d  Message  for  commit  #2     pick  5c67e61  Message  for  commit  #3     pick  33d5b7a  Message  for  commit  #1   fixup  9480b3d  Message  for  commit  #2     pick  5c67e61  Message  for  commit  #3    
  6. More   •  Apply  to  files   •  git  reset

     HEAD~2  foo.py   •  git  checkout  HEAD~2  foo.py  
  7. Git  hooks   •  In  other  technologies:  trigger   • 

    Six  types:   •  pre-­‐commit   •  prepare-­‐commit-­‐msg   •  post-­‐commit   •  post-­‐checkout   •  pre-­‐rebase  
  8. Git  hooks   Installing  hooks:   •  .git/hooks   • 

    applypatch-­‐msg.sample     •  pre-­‐push.sample     •  commit-­‐msg.sample     •  pre-­‐rebase.sample     •  post-­‐update.sample     •  prepare-­‐commit-­‐msg.sample     •  pre-­‐applypatch.sample   update.sample     •  pre-­‐commit.sample  
  9. Git  hooks   Installing  hooks:   •  .git/hooks   • 

    applypatch-­‐msg.sample     •  pre-­‐push.sample     •  commit-­‐msg.sample     •  pre-­‐rebase.sample     •  post-­‐update.sample     •  prepare-­‐commit-­‐msg.sample     •  pre-­‐applypatch.sample   update.sample     •  pre-­‐commit.sample    
  10. Git  hooks   Prepare  commit:     #!/bin/sh    

    echo  ”#  Please  include  a  useful  commit  message!"  >  $1  
  11. Git  hooks   #!/bin/sh     echo  ”#  Please  include

     a  useful  commit  message!"  >  $1  
  12. GitHooks  ideas   •  Checking  a  reference  to  a  library

     is  added   •  Checking  message  estructure   •  Rebasing  or  not  rebasing   •  SeGng  up  an  environment  when  there  is  a  checkout   •  Change  permissions