What is version control? Why use it? How do I use it?
See the lecture notes, but briefly:
- Version control lets you maintain successive versions of the software (and associated documents) that you develop
- Version control helps you:
- Try out ideas and (as needed) revert to previous ideas
- Combine the efforts of a team of software engineers
- To use version control, you:
- Checkout your project from the repository to your laptop
- Work on the project on your laptop
- Checkin your project from your laptop to the repository
- In our system, checkin involves four steps:
- Update to determine how your local copy now differs from the repository
- Add contents to add any new files that you created to your project
- Commit to copy the changes to your project back to the repository
- (sometimes) Tag the version to give the version a name (like Stage1, Stage2, etc)
Checkin a project as follows:
This example uses the JavaEyes project;
do other projects in a similar fashion, just changing the Module.
-
Update:
- What this does:
- This determines how your local copy now differs from the repository.
- Also, if your partner made any changes to the repository that conflict
with the changes that you made, CVS attempts to resolve the conflicts.
- How to do it:
- Right-click on your JavaEyes folder
- Select CVS Update
- Look at the output and ask questions about it as necessary.
- If the repository had changed
(because a teammate was working on it concurrently, for example)
then CVS will attempt to resolve the conflicts.
If it cannot, it will ask your help.
Usually, no conflicts will occur.
- After update, CVS shows you which files are modified by displying their icons in red (not green)
-
Add contents:
- What this does:
- This adds any new files that you created to your project
- How to do it:
- Right-click on your JavaEyes folder
- Select CVS Add Contents
- Look at the output and ask questions about it as necessary.
- CVS marks new files, if any, by a question mark.
- After add contents, those files become red
(like the other modified files ready to be committed to the repository)
-
Commit:
- What this does:
- This copies changes that you made in your local copy on your laptop back to the repository
- How to do it:
- Right-click on your JavaEyes folder
- Select CVS Commit
- Type a meaningful comment (e.g., "Version in the middle of Stage 1" or "Version after Stage 3") where it asks for one
- Look at the output and ask questions about it as necessary.
- After commit, CVS changes the modified (red) files to green icons
- You can always roll back to any version that you committed.
-
Tag:
- What this does:
- This tags the version with a name (of your choosing),
which makes it easy to checkout that version.
- The tags are important because we use such names to know what versions to grade!
- How to do it:
- Right-click on your JavaEyes folder
- Select CVS ~ Tag
- In the space provided, type the tag that the instructor demands, spelled EXACTLY as you are told
- Often we use Stage1, Stage2, etc., to tag the ends of Part 1, Part2, etc.
- Look at the output and ask questions about it as necessary.