If you've named a branch in CVS incorrectly, or the name originally chosen becomes inappropriate, how do you change it to something else?
A related question is How do you rename a branch in CVS without admin access?.
The trick to this is using one of CVSs' more obscure admin commands, -N. It is a two stage process, effectively copy then remove.
Firstly, you create a branch with the correct name that references the original branch name. Secondly, you delete the original branch name.
Assume you have a file "File.txt" that is currently branched "bad_
branch". You'd like the branch to be called - can you guess? - "good_
branch".
kwutchak% cvs log File.txt
RCS file: .../data/File.txt,v
head: 1.1
branch:
symbolic names:
bad_
branch: 1.1.0.2
cvs admin -N good_branch:bad_branch File.txt
kwutchak% cvs log File.txt
RCS file: .../data/File.txt,v
Working file: File.txt
head: 1.1
branch:
symbolic names:
good_
branch: 1.1.0.2
bad_
branch: 1.1.0.2
Bonus Tip:
A symbolic name is not always required with `-N`. It is sometimes
valid to use a numeric reference to the branch (as when one may have
used `cvs admin -N` and accidentally deleted the branch name by running
a delete command like `cvs admin -N bad_branch` when there is no
other name assigned yet. The following command worked to add a name
to a branch (that contained only one file) and the file no longer had
a branch name associated with it:
cvs admin -N good_branch:1.1.2.1 File.txt
cvs admin -N bad_branch File.txt
kwutchak% cvs log File.txt
RCS file: .../data/File.txt,v
Working file: File.txt
head: 1.1
branch:
symbolic names:
good_
branch: 1.1.0.2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With