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.

079fb5d4ef22e8fe922d1cbb4ef34a3a?s=128

Tess Barnes

October 14, 2015
Tweet

Transcript

  1. Version Control Tips, tricks and good citizenship blog.tessbarnes.uk @crataegustess Tess

    Barnes :: October 2015
  2. We see a lot of this… so we have to

    get used to this…
  3. But these… lets be honest…

  4. Really, really honest…

  5. 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
  6. So how do we fix them? Photo credit (CC BY

    2.0) JD Hancock
 https://www.flickr.com/photos/jdhancock/8755184025
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. photo credit (CC BY-SA 2.0) Sarabbit
 https://www.flickr.com/photos/sarabbit/4549185468

  16. Interesting reads http://phpboyscout.uk/php-scout/ http://betterexplained.com/articles/a-visual-guide-to-version-control/ http://www.makebetterthings.com/tag/subversion/ http://tortoisesvn.net/docs/release/TortoiseSVN_en/index.html http://tortoisegit.org/docs/tortoisegit/ https://git-scm.com/downloads http://www.laliluna.de/articles/2012/06/15/when-subversion-fails.html