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

Version Control Tips & Tricks

Version Control Tips & Tricks

Nervous of version control? Don’t panic! you’re not on your own. I've put together a run down of some of my tricks and ‘good citizen’ techniques to avoid the worst kinds of conflicts and deal with the remaining ones as efficiently as possible. Branching policies, basic conflict resolution, proactive diffs can all ease the pain of a tricky integration.

Tess Barnes

October 14, 2015
Tweet

More Decks by Tess Barnes

Other Decks in Programming

Transcript

  1. Why do we see so many? lots of developers lots

    of overlapping work context swapping impossible to talk all the time we are a bunch of (trainee) php scouts
  2. So how do we fix them? Photo credit (CC BY

    2.0) JD Hancock
 https://www.flickr.com/photos/jdhancock/8755184025
  3. Practice bonsai cultivate a well shaped tree check out at

    the right level branch carefully clean up photo credit (CC BY-ND 2.0) Beverly Vealach 
 https://www.flickr.com/photos/cowtools/293244244
  4. Be prepared Know the tools Keep a clean working copy

    - regular cleanup Avoid switching - run multiple working copies Watch where you leap - check commit logs first Communicate, collaborate - be a good citizen
  5. Interleaving changes how it occurs: a file with an old

    method changed by dev a to new method changed by dev b to different new method dev a commits, dev b updates can’t add my block above their block as it would create interleaved lines
  6. Interleaving changes - fixing how to fix: copy file.ext.mine to

    a new location accept in diff by ‘use {their} whole file’ & save copy in additional new method from .mine file
  7. Tree conflicts • Watch where you leap! • announce big

    refactors • check what others have 
 committed in this area • collaborate to get early warning • _then_ consider merging
  8. Tree conflict - add If you’re the second one in:

    1. undo the add 2. move your file somewhere outside working copy 3. merge up to your branch / working copy & commit 4. manually copy changes in
  9. Tree conflict - delete someone has deleted that nice file

    you fixed so beautifully… so find them and talk - it could be just a rename! renames can sometimes be solved by patch file massive refactors? talk, collaborate, hand copy feature removal? don't get frustrated, get coffee
  10. Solve with tech (git) Switching context? 
 Stash your work

    in progress Separate coding standards changes? 
 Cherry pick your commits in ‘hunks’ Tree conflicts when adding files?
 No such thing? Tree conflicts against deleted files?
 Just choose to delete or re-add