Version Control with Subversion for Subversion 1.2 (Book Compiled from Revision 2147)
Total Page:16
File Type:pdf, Size:1020Kb
Version Control with Subversion For Subversion 1.2 (book compiled from Revision 2147) Ben Collins-Sussman Brian W. Fitzpatrick C. Michael Pilato Version Control with Subversion: For Subversion 1.2: (book com- piled from Revision 2147) by Ben Collins-Sussman, Brian W. Fitzpatrick, and C. Michael Pilato Published (TBA) Copyright © 2002, 2003, 2004, 2005, 2006 Ben Collins-SussmanBrian W. FitzpatrickC. Michael Pilato This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit ht- tp://creativecommons.org/licenses/by/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. Table of Contents Foreword ..................................................................................................................................xi Preface ................................................................................................................................... xiii Audience ........................................................................................................................ xiii How to Read this Book ..................................................................................................... xiii Conventions Used in This Book .......................................................................................... xiv Typographic Conventions .......................................................................................... xiv Icons ..................................................................................................................... xiv Organization of This Book .................................................................................................. xv This Book is Free ............................................................................................................. xvi Acknowledgments ............................................................................................................ xvi From Ben Collins-Sussman ....................................................................................... xvii From Brian W. Fitzpatrick ........................................................................................ xvii From C. Michael Pilato ............................................................................................ xvii 1. Introduction ............................................................................................................................1 What is Subversion? ............................................................................................................ 1 Subversion's History ............................................................................................................ 1 Subversion's Features ........................................................................................................... 2 Subversion's Architecture ..................................................................................................... 3 Installing Subversion ........................................................................................................... 4 Subversion's Components ..................................................................................................... 5 A Quick Start .....................................................................................................................5 2. Basic Concepts ........................................................................................................................8 The Repository ...................................................................................................................8 Versioning Models .............................................................................................................. 8 The Problem of File-Sharing ......................................................................................... 9 The Lock-Modify-Unlock Solution ................................................................................. 9 The Copy-Modify-Merge Solution ............................................................................... 11 Subversion in Action ......................................................................................................... 13 Working Copies ........................................................................................................ 13 Revisions ................................................................................................................. 16 How Working Copies Track the Repository ................................................................... 17 Mixed Revision Working Copies .................................................................................. 18 Summary ......................................................................................................................... 19 3. Guided Tour ......................................................................................................................... 20 Help! .............................................................................................................................. 20 Import ............................................................................................................................. 20 Revisions: Numbers, Keywords, and Dates, Oh My! ................................................................ 20 Revision Numbers ..................................................................................................... 20 Revision Keywords ................................................................................................... 21 Revision Dates ......................................................................................................... 22 Initial Checkout ................................................................................................................ 23 Basic Work Cycle ............................................................................................................. 25 Update Your Working Copy ........................................................................................ 25 Make Changes to Your Working Copy .......................................................................... 26 Examine Your Changes .............................................................................................. 27 Resolve Conflicts (Merging Others' Changes) ................................................................. 33 Commit Your Changes ............................................................................................... 36 Examining History ............................................................................................................ 37 svn log .................................................................................................................... 38 svn diff ................................................................................................................... 39 svn cat .................................................................................................................... 41 svn list .................................................................................................................... 41 A Final Word on History ............................................................................................ 42 iv Version Control with Subversion Other Useful Commands .................................................................................................... 42 svn cleanup ............................................................................................................. 42 svn import .............................................................................................................. 43 Summary ......................................................................................................................... 43 4. Branching and Merging .......................................................................................................... 44 What's a Branch? .............................................................................................................. 44 Using Branches ................................................................................................................ 44 Creating a Branch ..................................................................................................... 46 Working with Your Branch ......................................................................................... 48 The Key Concepts Behind Branches ............................................................................. 50 Copying Changes Between Branches .................................................................................... 50 Copying Specific Changes .......................................................................................... 51 The Key Concept Behind Merging ............................................................................... 53 Best Practices for Merging .......................................................................................... 54 Common Use-Cases .......................................................................................................... 57 Merging a Whole Branch to Another ............................................................................. 57 Undoing Changes ...................................................................................................... 59 Resurrecting Deleted Items ........................................................................................