Version Control
Total Page:16
File Type:pdf, Size:1020Kb
Version Control CS 370 SE Practicum, Cengiz Günay (Some slides courtesy of Eugene Agichtein and the Internets) CS 370, Günay (Emory) Version Control Spring 2014 1 / 15 Project milestone: 4/10 functional prototype opens for testing Other news: May collect some experienced entrepreneurs/venture capitalists to see your projects at the end of semester Today: Version control Centralized: Subversion Distributed: GIT Agenda Make-up lecture: Diagrams useful for your project designs Watch it and do survey by Thursday 3/27 CS 370, Günay (Emory) Version Control Spring 2014 2 / 15 Other news: May collect some experienced entrepreneurs/venture capitalists to see your projects at the end of semester Today: Version control Centralized: Subversion Distributed: GIT Agenda Make-up lecture: Diagrams useful for your project designs Watch it and do survey by Thursday 3/27 Project milestone: 4/10 functional prototype opens for testing CS 370, Günay (Emory) Version Control Spring 2014 2 / 15 Today: Version control Centralized: Subversion Distributed: GIT Agenda Make-up lecture: Diagrams useful for your project designs Watch it and do survey by Thursday 3/27 Project milestone: 4/10 functional prototype opens for testing Other news: May collect some experienced entrepreneurs/venture capitalists to see your projects at the end of semester CS 370, Günay (Emory) Version Control Spring 2014 2 / 15 Agenda Make-up lecture: Diagrams useful for your project designs Watch it and do survey by Thursday 3/27 Project milestone: 4/10 functional prototype opens for testing Other news: May collect some experienced entrepreneurs/venture capitalists to see your projects at the end of semester Today: Version control Centralized: Subversion Distributed: GIT CS 370, Günay (Emory) Version Control Spring 2014 2 / 15 Advantages: I Track changes, keep logs of past development I Automatic backups/safety net I Concurrent versions: XP vs. Win8 I Allows teamwork Why Version Control? It's a must in today's computing industry I Mt. Gox, a company that don't use VC and lost almost a billion dollars. I Other painful stories without VC You can even version control documents, class les, nancial les, . Also called source control, code management, concurrent versioning, revision control, . CS 370, Günay (Emory) Version Control Spring 2014 3 / 15 Why Version Control? It's a must in today's computing industry I Mt. Gox, a company that don't use VC and lost almost a billion dollars. I Other painful stories without VC You can even version control documents, class les, nancial les, . Also called source control, code management, concurrent versioning, revision control, . Advantages: I Track changes, keep logs of past development I Automatic backups/safety net I Concurrent versions: XP vs. Win8 I Allows teamwork CS 370, Günay (Emory) Version Control Spring 2014 3 / 15 Teamwork on the same codebase: How? Seriously, how? CS 370, Günay (Emory) Version Control Spring 2014 4 / 15 Teamwork on the same codebase: How? Seriously, how? No control? Overwrite chaos! CS 370, Günay (Emory) Version Control Spring 2014 4 / 15 Teamwork on the same codebase: How? Seriously, how? Locking CS 370, Günay (Emory) Version Control Spring 2014 4 / 15 Teamwork on the same codebase: How? Seriously, how? Merging CS 370, Günay (Emory) Version Control Spring 2014 4 / 15 Merging example Each commit/check-in increments version What is Subversion? • A centralized version control system Repository • Not the newest form of configuration management, but easy to use and popular – Founded in 2000 – Successor to widely used CVS • Aka SVN Slide 6 Centralized version control: Subversion (SVN) Documentation http://svnbook.red-bean.com/ Common SVN usage scenario: 1 svn checkout gets working copy from repo 2 Make local changes in working copy 3 svn update gets latest changes from repo to sync 4 svn commit (or checkin) sends your changes to repo Example: How to nd a bug 1 You have been messing with the code 2 Suddenly you realized you broke the program 3 How do you nd when was the bug introduced? 4 Hint: Can go back with svn update -rX Investigating the past svn diff shows your changes from last repo version svn diff -cX shows changes in version X svn log [filename] shows all commit logs 4 Hint: Can go back with svn update -rX Investigating the past svn diff shows your changes from last repo version svn diff -cX shows changes in version X svn log [filename] shows all commit logs Example: How to nd a bug 1 You have been messing with the code 2 Suddenly you realized you broke the program 3 How do you nd when was the bug introduced? Investigating the past svn diff shows your changes from last repo version svn diff -cX shows changes in version X svn log [filename] shows all commit logs Example: How to nd a bug 1 You have been messing with the code 2 Suddenly you realized you broke the program 3 How do you nd when was the bug introduced? 4 Hint: Can go back with svn update -rX Advanced concepts: tags, branches, and merging svn tag <name> [-rX] marks a version 1 (e.g., release) Trunks svn copy clones current version as branch 2 Branches svn merge reintegrates branch to main trunk 3 4 Merges T1 Tags 5 6 7 8 9 Discontinued T2 development branch 10 CS 370, Günay (Emory) Version Control Spring 2014 9 / 15 Advanced concepts: tags, branches, and merging svn tag <name> [-rX] marks a version 1 (e.g., release) Trunks svn copy clones current version as branch 2 Branches svn merge reintegrates branch to main trunk 3 What is it good for? 4 Merges Tags for beta test releases, main releases, patches T1 Branches for experimental development Tags 5 See the SVN book for more info 6 7 8 9 Discontinued T2 development branch 10 CS 370, Günay (Emory) Version Control Spring 2014 9 / 15 Obvious: it's centralized! Needs network for: 1 making commits 2 getting updates 3 inspecting revision history (logs, di, etc) What if you're coding on a plane? I Enter distributed version control Limitations of centralized version control Tell me! CS 370, Günay (Emory) Version Control Spring 2014 10 / 15 I Enter distributed version control Limitations of centralized version control Tell me! Obvious: it's centralized! Needs network for: 1 making commits 2 getting updates 3 inspecting revision history (logs, di, etc) What if you're coding on a plane? CS 370, Günay (Emory) Version Control Spring 2014 10 / 15 Limitations of centralized version control Tell me! Obvious: it's centralized! Needs network for: 1 making commits 2 getting updates 3 inspecting revision history (logs, di, etc) What if you're coding on a plane? I Enter distributed version control CS 370, Günay (Emory) Version Control Spring 2014 10 / 15 Can do all VC operations locally now! Thus you need to clone a repo Get your own repo! Get your own repo! Can do all VC operations locally now! Thus you need to clone a repo Remote operations (new concepts): Pull: Get all changesets from origin repo Push: Send your changesets to origin Still has origin repo to communicate between team members In Git, pull can be divided into fetch+merge (like SVN branch merge) So what is local and what is remote? Local operations (same as previous): update/commit tag/branch log/di Still has origin repo to communicate between team members In Git, pull can be divided into fetch+merge (like SVN branch merge) So what is local and what is remote? Local operations (same as previous): update/commit tag/branch log/di Remote operations (new concepts): Pull: Get all changesets from origin repo Push: Send your changesets to origin So what is local and what is remote? Local operations (same as previous): update/commit tag/branch log/di Remote operations (new concepts): Pull: Get all changesets from origin repo Push: Send your changesets to origin Still has origin repo to communicate between team members In Git, pull can be divided into fetch+merge (like SVN branch merge) We will use Github We have educational account with private repositories Open accounts on GitHub and send us your account ids! Example GitHub project Git documentation: http://git-scm.com/documentation History of version control software Revision Control System (RCS): Provided ci, co (checkin, checkout) commands under UNIX. Create revisions for each le invidually Concurrent Version System (CVS): Like RCS, but systemic for directories Collects revision les into repos Subversion (SVN): Allows renaming directories easily Revisions not in les, but kept in database GIT: Because somebody called Linus Torvald a git Developed to keep track of changes in Linux kernel Others: Microsoft SourceSafe, Mercurial, . CS 370, Günay (Emory) Version Control Spring 2014 15 / 15.