- Why is it a good idea to use version control on your projects? (Answer)
- Easier to share files with other people
- You can’t overlook other people’s changes
- Nothing is ever lost, so you can look at older versions of your files
- Explain what the “master copy” and “working copy” of a repository are. To which copy do users make their changes? (Answer)
The “master copy” is the set of files in the repository, stored on a server somewhere. Files in the master copy are not changed directly. Instead, users “check out” a copy of the contents of the repository to their computers (this is the “working copy”) and make changes there.
- Suppose you’ve created a new file on your computer that you want to put into the repository. How do you go about doing this? (Answer)
Make sure the file is somewhere in the directory for your working copy. You then have to “add” the file to the repository (using the command line, SmartSVN, or some other interface), and then “commit” the file, being sure to give a descriptive comment.
- Jon is working on a version-controlled project with Ainsley and Tommy. He wakes up early one day, ready to do some work on the project. What is the first thing he should do? (Answer)
Review any changes that the other users have made to the repository, and then update his working copy.
- Tommy and Jon have up-to-date working copies, and are both editing a file that contains 10 lines of data. Jon makes a change to the fifth line, and commits his changes. Tommy makes a change to the first line of the file, and tries to commit. What will happen, and what should Tommy do next? (Answer)
Tommy will not be able to commit since he is no longer up-to-date with the master copy. He should “update” his working copy. Jon’s changes will not conflict with Tommy’s, since they edited different lines of the file. Tommy can now commit his changes.
- Ainsley and Jon are up-to-date, and are both editing the sixth line of a file. Jon commits his changes first. When Ainsley tries to commit, what will happen, and what should she do next? (Answer)
Ainsley will not be able to commit, since she is not up-to-date with the master copy. She should “update” her working copy. Since Ainsley and Jon both edited the same line, she will have to resolve the conflict before she can commit her changes.
- How do you undo local changes to files that have not been committed? (Answer)
Use subversion’s “revert” command.
- How do you “undo” changes that have been committed? (Let’s assume you are at revision 10, and want to “go back” to revision 9.) (Answer)
Do a reverse merge from revision 9 to HEAD.
- Give the shell commands you would use to accomplish the following tasks:
- Check out the repository located at http://example.com/repo into the directory /cygwin/home/repo (Answer)
svn co http://example.com/repo /cygwin/home/repo
- View the log of changes (Answer)
- Add the file “experiment.txt” to the repository (Answer)
- Commit the file to the repository. (Answer)
svn commit -m "Added the experiment.txt file"
- Update a working copy of a repository (Answer)