1 / 19

Version control

Version control. Michael Tsai 2011/5/5. Reference. http://betterexplained.com/articles/a-visual-guide-to-version-control / http:// www.ericsink.com/scm/source_control.html http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated /. Version control.

mindy
Download Presentation

Version control

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Version control Michael Tsai 2011/5/5

  2. Reference • http://betterexplained.com/articles/a-visual-guide-to-version-control/ • http://www.ericsink.com/scm/source_control.html • http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

  3. Version control • Also called “source control” • Other alias • source configuration management • source code management

  4. You have been doing it • Your own version control system: • KalidAzadResumeOct2006.doc • KalidAzadResumeMar2007.doc • instacalc-logo3.png • instacalc-logo4.png • logo-old.png • “Save as”: leave the old version intact. • Single backup file: Document.old.doc • Version number or date: Document_V1.doc • Share folder for other people to access/modify the file(s)

  5. But it doesn’t scale • Imagine putting all the related files of a gigantic software project (e.g. WINDOWS 8) in a single shared folder, and have thousands of developers accessing it. • NO WAY.

  6. What does a version control system do? • Backup and Restore. Files are saved as they are edited, and you can jump to any moment in time. Need that file as it was on Feb 23, 2007? No problem. • Synchronization. Lets people share files and stay up-to-date with the latest version. • Short-term undo. Monkeying with a file and messed it up? (That’s just like you, isn’t it?). Throw away your changes and go back to the “last known good” version in the database.

  7. What does a version control system do? • Long-term undo. Sometimes we mess up bad. Suppose you made a change a year ago, and it had a bug. Jump back to the old version, and see what change was made that day. • Track Changes. As files are updated, you can leave messages explaining why the change happened (stored in the VCS, not the file). This makes it easy to see how a file is evolving over time, and why. • Track Ownership. A VCS tags every change with the name of the person who made it. Helpful for blamestorming giving credit.

  8. What does a version control system do? • Sandboxing, or insurance against yourself. Making a big change? You can make temporary changes in an isolated area, test and work out the kinks before “checking in” your changes. • Branching and merging. A larger sandbox. You can branch a copy of your code into a separate area and modify it in isolation (tracking changes separately). Later, you can merge your work back into the common area.

  9. Learn some terms Client Server Repository (file database) Working copy v3_new_test Trunk: main line v2_devel Working copy v1_old_stable

  10. Checkout and Edit Main trunk r3: milk eggs juice r4: milk eggs soup Check out Working copy: milk eggs soup Check in Revert

  11. Basic Diffs Main trunk r1: milk r4: milk eggs soup r2: milk eggs r3: milk eggs juice -juice, +soup +juice +eggs ????

  12. r5: milk eggs soup r6: milk eggs rice Branching New Features Main trunk r4: milk eggs soup r7: milk eggs soup bread

  13. r5: milk eggs soup r6: milk eggs rice Merging +rice New Features Main trunk r4: milk eggs soup r7: milk eggs soup bread r8: milk eggs soup bread rice +bread +rice

  14. -eggs +cheese Conflicts Working copy (r3*): milk cheese juice Valid check-in r4: milk cheese juice r3: milk eggs juice Main trunk -eggs +hot dog Conflicting check-in (cannot remove eggs) Working copy (r3*): milk hot dog juice

  15. How to resolve the conflict? • Re-apply your changes. Sync to the latest version (r4) and re-apply your changes to this file: Add hot dog to the list that already has cheese. • Override their changes with yours. Check out the latest version (r4), copy over your version, and check your version in. In effect, this removes cheese and replaces it with hot dog.

  16. Tag Main trunk r1: milk r4: milk eggs soup r2: milk eggs r3: milk eggs juice 1.0 2.0 1.5

  17. Real world example - simplified Windows MP 11 IE 6 Windows MP 11 IE 7 M11 Windows MP 10 IE 6 IE7 RI MP FI Windows MP 11 IE 7 Main trunk Windows MP 10 IE 6 FI IE RI Windows MP 10 IE 7 Windows MP 11 IE 7 IE7 Windows MP 10 IE 6 MP11

  18. How do I get started? • Try subversion. It’s free! (not the fastest/fanciest/most powerful on the market, but it’s good enough for most projects) • Windows GUI for subversion: TortoiseSVNhttp://tortoisesvn.tigris.org/ • Very easy to use! • Free book about subversion: http://svnbook.red-bean.com/ • We will have a homework for you next week (HW4-2) • Once you know how to use it, make it a habit (not hard at all).

  19. Further reading • Distributed Version Control: http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/ • (don’t know if we will cover it this semester)

More Related