Previous: Multiple Merges, Up: Branches

Creating A Tag Or Branch Without A Working Copy

As stated earlier, tagging affects the repository, not the working copy. That begs the question: Why require a working copy at all when tagging? The only purpose that it serves is to designate which project and which revisions of the various files in the project are being tagged. If you could specify the project and revisions independently of the working copy, no working copy would be necessary.

There is such a way: the rtag command (for "repository tag"). It's very similar to tag; a couple of examples will explain its usage. Let's go back to the moment when the first bug report came in and we needed to create a branch rooted at the last public release. We checked out a working copy at the release tag and then ran tag -b on it:

     floss$ cvs tag -b Release-1999_05_01-bugfixes

This created a branch rooted at Release-1999_05_01. However, because we know the release tag, we could have used it in an rtag command to specify where to root the branch, not even bothering with a working copy:

     floss$ cvs rtag -b -r Release-1999_05_01 Release-1999_05_01-bugfixes myproj

That's all there is to it. That command can be issued from anywhere, inside or outside a working copy. However, your CVSROOT environment variable would have to point to the repository, of course, or you can specify it with the global -d option. It works for non-branch tagging, too, but it's less useful that way because you have to specify each file's revision number, one by one. (Or you can refer to it by tag, but then you'd obviously already have a tag there, so why would you want to set a second one on the exact same revisions?)

You now know enough to get around in CVS and probably enough to start working with other people on a project. There are still a few minor features that haven't been introduced, as well as some unmentioned but useful options to features already seen. These will all be presented as appropriate in chapters to come, in scenarios that will demonstrate both how and why to use them. When in doubt, don't hesitate to consult the Cederqvist manual; it is an indispensable resource for serious CVS users.

Karl Fogel wrote this book. Buy a printed copy via his homepage at

copyright  ©  January 18 2019 sean dreilinger url: