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

atomic commits

atomic commits

Kai Howelmeyer

January 21, 2014
Tweet

More Decks by Kai Howelmeyer

Other Decks in Research

Transcript

  1. atomic commit A commit only containing changes that logically belong

    together and cannot be split up any further without breaking the intent of the commit.
  2. Commit early and often on a feature branch. It  works

      Fixed  a  typo   Added  a  test   Refactored  a   li6le   Added   another  part   Improved   performance  
  3. When done, git  merge  -­‐-­‐squash       on master

    Master   Commit  1   Master   Commit  2   …   Master   Commit  n   Our  enBre   feature   staged  
  4. Then git  add  -­‐p   Only choose hunks that belong

    into one atomic commit. Master   Commit  1   Master   Commit  2   …   Master   Commit  n   Remainder   unstaged   Atomic   Commit  1   staged  
  5. Check with          git  diff  -­‐-­‐staged  

      Master   Commit  1   Master   Commit  2   …   Master   Commit  n   Remainder   unstaged   Atomic   Commit  1   staged  
  6. Commit with meaningful message. Master   Commit  1   …

      Master   Commit  n   Atomic   Commit  1   Remainder   unstaged  
  7. git  stash  -­‐u   Leaves clean working copy. Check integrity

    of system. Master   Commit  1   …   Master   Commit  n   Atomic   Commit  1   Remainder   stashed  
  8. git  stash  pop   Stage next atomic commit with git

     add  -­‐p     Master   Commit  1   …   Master   Commit  n   Atomic   Commit  1   Remainder   unstaged   Atomic   Commit  2   staged  
  9. Next time Determine code ownership w/ log & blame - 

    or - How I fell in love with vim-fugitive