Книги и журналы » Компьютерная литература » Программирование (книги)
Version Control by ExampleГод издания: 2011
Автор: Eric Sink
Издательство: Pyrenean Gold Press
ISBN: 0983507902
Язык: Английский
Формат: PDF
Качество: Издательский макет или текст (eBook)
Интерактивное оглавление: Нет
Количество страниц: 226
Описание: Version Control by Example may as well be called The Hitchhiker's Guide to Distributed Version Control -- it's a concise and informative compendium that serves as both an introduction and a manual for practical usage of Mercurial, Git, Veracity, and virtually any other version control system. --Alex Papadimoulis, The Daily WTF
Eric covers multiple tools in lighthearted style that makes a potentially dry subject both amusing and understandable. If version control is a new tool in your programmers belt, this book is a great place to start. --Ben Collins-Sussman, Apache Subversion Developer
Version control is a critical tool in the developer's tool chain. So it's disappointing to consider just how few developers actually understand their version control system beyond the minimal incantations required merely to survive a day of coding at the office. Thanks to Eric Sink's new book on the topic, this need be the case no longer. Version Control by Example is organized well, light in tone, yet saturated with practical illustrations of not only how to choose among and use today's most popular free version control tools, but how to do so with efficiency, understanding, and purpose. --C. Michael Pilato, Apache Subversion Developer
Apache Subversion's rise to popularity opened the floodgates for others to explore new features and designs in version control, the most popular being Distributed Version Control Systems (DVCS). In a balanced way, this book covers the most popular tools today and whether you should choose a DVCS for your development. --Greg Stein, Apache Subversion Developer
[spoiler="Примеры страниц"]



[/spoiler]
[spoiler="Оглавление"]
Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 1
A History of Version Control . . . . . . . . . . . . . . . . . . . . . . . 1
My Background . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Reading this book . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Part 1. Centralized Version Control . . . . . . . . . . . . . . . . . . 4
Chapter 2. Basics . . . . . . . . . . . . . . . . . . . . . . . . . 5
Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Checkout . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Commit . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Update . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Add . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Edit . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Rename . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Move . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Status . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Diff . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Revert . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Log . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Merge . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Resolve . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Lock . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Chapter 3. Basics with Subversion . . . . . . . . . . . . . . . . . . . 16
Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Checkout, Add, Status, Commit . . . . . . . . . . . . . . . . . . . . . 17
Log, Diff . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Update, Commit (with a merge) . . . . . . . . . . . . . . . . . . . . 20
Update (with merge) . . . . . . . . . . . . . . . . . . . . . . . 24
Move . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Rename . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Lock, Revert . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Merge (no conflicts) . . . . . . . . . . . . . . . . . . . . . . . . 38
Merge (repeated, no conflicts) . . . . . . . . . . . . . . . . . . . . . 40
Merge (conflicts) . . . . . . . . . . . . . . . . . . . . . . . . 42
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Part 2. Distributed Version Control . . . . . . . . . . . . . . . . . . 47
Chapter 4. More Basics . . . . . . . . . . . . . . . . . . . . . . . 48
Clone . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Push . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Pull . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Directed Acyclic Graphs (DAGs) . . . . . . . . . . . . . . . . . . . . . 50
Chapter 5. Advantages . . . . . . . . . . . . . . . . . . . . . . . 55
Private Workspace . . . . . . . . . . . . . . . . . . . . . . . . 55
Fast . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Offline . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Geography . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Flexible Workflows . . . . . . . . . . . . . . . . . . . . . . . . 58
Easier Merging . . . . . . . . . . . . . . . . . . . . . . . . . 58
Implicit Backup . . . . . . . . . . . . . . . . . . . . . . . . . 59
Scale out, not just up . . . . . . . . . . . . . . . . . . . . . . . 59
Chapter 6. Weaknesses . . . . . . . . . . . . . . . . . . . . . . . 60
Locks . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Very Large Repositories . . . . . . . . . . . . . . . . . . . . . . . 60
Integration . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Obliterate . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Administration . . . . . . . . . . . . . . . . . . . . . . . . . 62
Path-Based Access Control . . . . . . . . . . . . . . . . . . . . . . 62
Ease of Use . . . . . . . . . . . . . . . . . . . . . . . . . . 63
GUIs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Chapter 7. Basics with Mercurial . . . . . . . . . . . . . . . . . . . . 64
Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Clone, Add, Status, Commit . . . . . . . . . . . . . . . . . . . . . . 64
Push, Pull, Log, Diff . . . . . . . . . . . . . . . . . . . . . . . . 66
Update, Commit (with a merge) . . . . . . . . . . . . . . . . . . . . 69
Update (with merge) . . . . . . . . . . . . . . . . . . . . . . . 74
Move . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Rename . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Revert . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Merge (no conflicts) . . . . . . . . . . . . . . . . . . . . . . . . 87
Merge (repeated, no conflicts) . . . . . . . . . . . . . . . . . . . . . 89
Merge (conflicts) . . . . . . . . . . . . . . . . . . . . . . . . 91
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Chapter 8. Basics with Git . . . . . . . . . . . . . . . . . . . . . . 96
Create . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Clone, Add, Status, Commit . . . . . . . . . . . . . . . . . . . . . . 96
Push, Pull, Log, Diff . . . . . . . . . . . . . . . . . . . . . . . . 99
Update, Commit (with a merge) . . . . . . . . . . . . . . . . . . . .102
Update (with merge) . . . . . . . . . . . . . . . . . . . . . . .106
Move . . . . . . . . . . . . . . . . . . . . . . . . . . .110
Rename . . . . . . . . . . . . . . . . . . . . . . . . . . .112
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . .114
Revert . . . . . . . . . . . . . . . . . . . . . . . . . . .116
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . .118
Branch . . . . . . . . . . . . . . . . . . . . . . . . . . .119
Merge (no conflicts) . . . . . . . . . . . . . . . . . . . . . . . .120
Merge (repeated, no conflicts) . . . . . . . . . . . . . . . . . . . . .122
Merge (conflicts) . . . . . . . . . . . . . . . . . . . . . . . .124
Summary . . . . . . . . . . . . . . . . . . . . . . . . . .128
Chapter 9. About Veracity . . . . . . . . . . . . . . . . . . . . . .130
Decentralized Database . . . . . . . . . . . . . . . . . . . . . . .130
User Accounts . . . . . . . . . . . . . . . . . . . . . . . . .131
Commercial Open Source . . . . . . . . . . . . . . . . . . . . . .131
Designed for Integration . . . . . . . . . . . . . . . . . . . . . .131
Apache License 2.0 . . . . . . . . . . . . . . . . . . . . . . . .132
Formal Rename and Move . . . . . . . . . . . . . . . . . . . . . .132
Repository Storage Plugins . . . . . . . . . . . . . . . . . . . . . .132
Multiple Working Copies . . . . . . . . . . . . . . . . . . . . . .133
Locks . . . . . . . . . . . . . . . . . . . . . . . . . . .133
JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . .133
Stamp . . . . . . . . . . . . . . . . . . . . . . . . . . .134
Hash Functions . . . . . . . . . . . . . . . . . . . . . . . . .134
Scrum . . . . . . . . . . . . . . . . . . . . . . . . . . .134
Chapter 10. Basics with Veracity . . . . . . . . . . . . . . . . . . . .136
Create . . . . . . . . . . . . . . . . . . . . . . . . . . .136
Clone, Add, Status, Commit . . . . . . . . . . . . . . . . . . . . . .137
Push, Pull, Log, Diff . . . . . . . . . . . . . . . . . . . . . . . .139
Update, Commit (with a merge) . . . . . . . . . . . . . . . . . . . .142
Update (with merge) . . . . . . . . . . . . . . . . . . . . . . .147
Move . . . . . . . . . . . . . . . . . . . . . . . . . . .151
Rename . . . . . . . . . . . . . . . . . . . . . . . . . . .153
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . .155
Lock, Revert . . . . . . . . . . . . . . . . . . . . . . . . . .156
Tag . . . . . . . . . . . . . . . . . . . . . . . . . . . .158
Branch . . . . . . . . . . . . . . . . . . . . . . . . . . .159
Merge (no conflicts) . . . . . . . . . . . . . . . . . . . . . . . .161
Merge (repeated, no conflicts) . . . . . . . . . . . . . . . . . . . . .163
Merge (conflicts) . . . . . . . . . . . . . . . . . . . . . . . .166
Summary . . . . . . . . . . . . . . . . . . . . . . . . . .170
Part 3. Beyond Basics . . . . . . . . . . . . . . . . . . . . . . .173
Chapter 11. Workflows . . . . . . . . . . . . . . . . . . . . . . .174
Managing Multiple Releases . . . . . . . . . . . . . . . . . . . . .174
Shrinkwrap . . . . . . . . . . . . . . . . . . . . . . . . . .174
Polishing Branches . . . . . . . . . . . . . . . . . . . . . .176
Release Branches . . . . . . . . . . . . . . . . . . . . . . .177
Feature Branches . . . . . . . . . . . . . . . . . . . . . .180
Web . . . . . . . . . . . . . . . . . . . . . . . . . . . .181
Chapter 12. DVCS Internals . . . . . . . . . . . . . . . . . . . . . .183
Deltas . . . . . . . . . . . . . . . . . . . . . . . . . . .183
Git: Cryptographic Hashes . . . . . . . . . . . . . . . . . . . . . .184
Example with SHA-1 . . . . . . . . . . . . . . . . . . . . . .184
Collisions . . . . . . . . . . . . . . . . . . . . . . . . .186
Mercurial: Repository Structure . . . . . . . . . . . . . . . . . . . .187
Revlogs . . . . . . . . . . . . . . . . . . . . . . . . .187
Manifests . . . . . . . . . . . . . . . . . . . . . . . . .188
Changesets . . . . . . . . . . . . . . . . . . . . . . . .189
Veracity: DAGs and Data . . . . . . . . . . . . . . . . . . . . . .189
DAGs and Blobs . . . . . . . . . . . . . . . . . . . . . . .189
Changesets . . . . . . . . . . . . . . . . . . . . . . . .192
Treenodes . . . . . . . . . . . . . . . . . . . . . . . .193
DB Records . . . . . . . . . . . . . . . . . . . . . . . .194
Templates . . . . . . . . . . . . . . . . . . . . . . . .196
Repository Storage . . . . . . . . . . . . . . . . . . . . . .198
Blob Encodings . . . . . . . . . . . . . . . . . . . . . . .199
Chapter 13. Best Practices . . . . . . . . . . . . . . . . . . . . . .201
Run diff just before you commit, every time . . . . . . . . . . . . . . . . .201
Read the diffs from other developers too . . . . . . . . . . . . . . . . . .201
Keep your repositories as small as possible . . . . . . . . . . . . . . . . . .201
Group your commits logically . . . . . . . . . . . . . . . . . . . . .201
Explain your commits completely . . . . . . . . . . . . . . . . . . . .201
Only store the canonical stuff . . . . . . . . . . . . . . . . . . . . .202
Don’t break the tree . . . . . . . . . . . . . . . . . . . . . . . .202
Use tags . . . . . . . . . . . . . . . . . . . . . . . . . . .202
Always review the merge before you commit. . . . . . . . . . . . . . . . . .203
Never obliterate anything . . . . . . . . . . . . . . . . . . . . . .203
Don’t comment out code . . . . . . . . . . . . . . . . . . . . . .203
Use locks sparingly . . . . . . . . . . . . . . . . . . . . . . . .204
Build and test your code after every commit . . . . . . . . . . . . . . . . .204
Appendix A. Comparison Table . . . . . . . . . . . . . . . . . . . . . .205
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . .207
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .217
[/spoiler]