cvs安裝使用vim
[root@www ~]#yum install cvs
cvs 功能:
1.跟蹤的版本。
2.記錄改變日期及改變理由。
3.具備回滾能力。
選擇倉庫:
[root@www ~]#useradd tom
[root@www ~]#echo redhat|passwd --stdin tom
[root@www ~]#useradd jack
[root@www ~]#echo redhat|passwd --stdin jack
[jack@www ~]$vim .bashrc
export CVSROOT=/var/cvs #本地倉庫
export CVSROOT=:ext:cvsserv:/var/cvs #遠程倉庫
export CVS_RSH=/usr/bin/ssh #添加雙機信任
[jack@www ~]$source .bashrc #定義當即生效
[tom@www ~]$vim .bashrc
export CVSROOT=/var/cvs #本地倉庫
export CVSROOT=:ext:cvsserv:/var/cvs #遠程倉庫
export CVS_RSH=/usr/bin/ssh #添加雙機信任
[tom@www ~]$source .bashrc #定義當即生效
使用cvs
cvs使用的經常使用命令:
cvs checkout module #下載倉庫
cvs update #更新倉庫
cvs add file #往倉庫添加內容
cvs remove file #從倉庫刪除內容
cvs commit #提交
cvs -d /var/cvs/ init #cvs目錄綁定
[root@www ~]#groupadd -g 6000 cvsadmin
[root@www ~]#grouadd -g 6001 cvsusers
[root@www ~]#usermod -a -G cvsusers tom
[root@www ~]#usermod -a -G cvsadmin tom
[root@www ~]#usermod -a -G cvsusers jack
[root@www ~]#usermod -a -G cvsadmin jack
[root@www ~]#mkdir /var/cvs/dnsfile
cvs
cvs import dnsfile training start #提交dnsfile文件
cvs commit #提交
報錯解決:
cvs commit 提交失敗時使用cvs update 更新倉庫使版本爲最新,用cvs update 方能解決再提交。
案例解析;
1,添加新文件
cd 工做目錄
[jack@www ~]$ create the file #建立新文件
[jack@www ~]$ cvs add file #往cvs 添加新文件
[jack@www ~]$ cvs commit file #提交新文件
2.刪除文件
[jack@www ~]$cd 工做目錄
[jack@www ~]$rm file
[jack@www ~]$cvs remove file
[jack@www ~]$cvs commit file
3.給文件更名字
cd 工做目錄
[jack@www ~]$mv old new
[jack@www ~]$cvs remove old
[jack@www ~]$cvs add new
[jack@www ~]$cvs commit new
4.查看更改歷史記錄
[jack@www ~]$cvs history -a #顯示全部checkout的信息
[jack@www ~]$cvs history -a -c #顯示全部commit的信息
[jack@www ~]$cvs log
[jack@www ~]$cvs diff
[jack@www ~]$cvs log file
[jack@www ~]$cvs diff -r oldfile newfile
5.回滾歷史版本
[tom@www ~]$rm file
[tom@www ~]$cvs update -j HEAD -j 1.1 file
[tom@www ~]$cvs commit file
6.定義二進制文件
[tom@www ~]$ vim CVSROOT/cvswrappers
*.gif -k 'b' -m 'COPY'
[tom@www ~]$cvs add -kb file.jpg #添加二進制文件
[tom@www ~]$cvs commit file.jpg