1 / 23

Version Control

Version Control. CS 30700 These outstanding slides were created by Kevin Schenk, BS in Computer Science, Purdue University, 2012. What is version control ?.

barny
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 CS 30700These outstanding slides were created by Kevin Schenk, BS in Computer Science, Purdue University, 2012.

  2. What is version control? • Version control (or revision control) is the term for the management of source files, and all of the intermediate stages as development proceeds. • A version control system is a repository of files. Every change made to the source is tracked, along with who made the change, etc. • Other items can be kept in a version control system in addition to source files -- Project Charter, Product Backlog, Design Document, Sprint Planning Document, Sprint Retrospective….

  3. Version Control Examples

  4. Why is version control important? • Version control allows us to: • Keep everything of importance in one place • Manage changes made by the team • Track changes in the code and other items • Avoid conflicting changes

  5. Features of Version Control • Reversion: If you make a change, and discover it is not viable, how can you revert to a code version that is known to be good? • Change/Bug Tracking: You know that your code has changed; but do you know who did it, when, and why? Sometimes this is where a bug was introduced? • Branches: How to introduce a completely new feature or concept and not mess up the working code? • Merging branches: If I divided the code, how to merge new code with good old code and not mess up

  6. Committing Code • Commit:the action of writing or merging the changes made in the working copy back to the repository • Trunk: The unique line of development that is not a branch (sometimes called the baselineor mainline) • Head: The most recent commit Main Trunk Apple Apple Orange Apple Orange Banana Apple Orange Strawberry Revision 1 Revision 2 Revision 3 Revision 4 (HEAD)

  7. Committing Code (SVN) • To add the file to the repository: • To check-in (commit) the file: • The -m flag is the message to use for this check-in. • Note: Subversion (svn) commands are described in http://www.yolinux.com/TUTORIALS/Subversion.html svn add list.txt svn ci list.txt –m “Changed the list”

  8. Checking Out & Editing Code Main Trunk Apple Orange Banana Check Out Apple Orange Strawberry Revision 3 Revision 4 Apple Orange Strawberry Revert Working Copy Check In (Commit)

  9. Checking Out Code (SVN) • To get the latest version: • To throw away changes: • To check out a particular version: svn checkout list.txt svn revert list.txt svn checkout –r2 list.txt

  10. Differences Main Trunk • Most version control systems store diffs rather than full copies of the file. This saves disk space. -Apple +Grape +Orange +Banana Apple Apple Orange Apple Orange Banana Orange Banana Grape svn diff –r3:4 list.txt Revision 1 Revision 2 Revision 3 Revision 4

  11. Branching Code • A set of files under version control may be branched (or forked) at a point in time so that, from that time forward, two (or more!) copies of a file may develop in different ways independently of each other. Apple Grape Apple Grape Cherry Revision 5 Revision 6 Branch Main Trunk Apple Grape Apple Grape Kiwi In SVN: svn copy /path/to/trunk /path/to/branch Revision 4 Revision 7

  12. Merging Code Apple Grape Apple Grape Cherry +Cherry Revision 5 Revision 6 Branch Main Trunk Apple Grape Apple Grape Kiwi Apple Grape Kiwi Cherry +Kiwi +Cherry Revision 4 Revision 7 Revision 8 In SVN: svn merge –r6:7 /path/to/branch

  13. Conflicts • A conflict occurs when different team members make changes to the same document, and the system is unable to reconcile the changes. A user must resolve the conflict by combining or manually editing the changes. Apple Grape Cherry Check In Revision 4* (Bob) Apple Grape Apple Grape Cherry Main Trunk Revision 4 Revision 5 Apple Kiwi Check In Conflict Revision 4* (Alice)

  14. Centralized vs. Distributed Version Control Systems

  15. Centralized Version Control Systems • Centralized version control systems are based on the idea that there is a single “central” copy of your project on a single server and programmers “commit” their changes to this central copy.

  16. Centralized Version Control Systems • Advantages • Easy to understand • Saves space – only one copy of each file • Disadvantages • Dependent on access to the server • Can be slow since every transaction requires a connection to the server

  17. Distributed Version Control Systems • Distributed version control systems do not rely on a central server to store all the versions of a project’s files. • Instead, every developer “clones” a copy of the repository and has a virtual copy of the full project on his/her own machine • Distributed systems are a newer option.

  18. Distributed Version Control Systems • Advantages • No server necessary – all actions are local . • Faster. • Disadvantages • A lot happens behind the scenes with some chance of undetected conflicts.

  19. Version Control Requirement in CS 30700 • Each team must use some version control system • Instead of turning in documents and code on BlackBoard, teams will simply commit their documents and code to their repository • Give your Project Coordinator access to view your repository and to track changes

  20. GitHub • GitHub is a web-based hosting service for software development projects that use the Git revision control system • GitHub <https://github.com> • GitHub offers free accounts for open source projects

  21. GitHub • GitHubDocumentation <https://help.github.com> • GitHub is the most popular open source code repository site • We suggest you use GitHub to gain experience with it • Employers, startups, and hackathons increasingly use Github

  22. Bitbucket • Bitbucket is a web-based hosting service for projects that use either the Git or Mercurial revision control systems • Bitbucket<https://bitbucket.org> • Bitbucket Free Academic Accounts <http://blog.bitbucket.org/2012/08/20/bitbucket-academic> • Bitbucket Documentation <https://confluence.atlassian.com/display/BITBUCKET/Bitbucket+Documentation+Home>

  23. Version Control References • Subversion (SVN) - http://subversion.apache.org • TortoiseSVN (Windows) - http://tortoisesvn.tigris.org • Concurrent Version Systems (CVS) - http://savannah.nongnu.org/projects/cvs • Git - http://git-scm.com • TortoiseGit(Windows) - http://code.google.com/p/tortoisegit • Mercurial - http://mercurial.selenic.com • RabbitVCS(Linux) - http://www.rabbitvcs.org

More Related