版本管理


参考:

linux下安装SVN      http://jingyan.baidu.com/article/3c343ff7039de20d37796306.html

svn客户端使用linux篇  http://jeanlyn.sinaapp.com/svn_linux/

==================================

svn使用简介

1)创建目录:

mkdir /home/svn_hl_gg/

cd /home/svn_hl_gg/

2)下载代码:checkout

svn checkout https://192.168.1.105/svn/gg/ .


3)生成文件夹,提交代码

mkdir 22;

cd 22;

echo thisis22 >> 22.txt;

cd ..;

svn add 22;

svn commit -m "create 22 for gg";//执行这一步之后,代码才算真正上传到服务器了,这个时候管理者和其他组员能在仓库看见此代码。


4)修改代码并上传

vi 22.txt;

[root@localhost 22]# svn commit -m "added version2 for 22.txt"

Sending        22/22.txt

Transmitting file data .

Committed revision 4.

5)删除代码

[root@localhost 22]# svn del 22.txt

D         22.txt

[root@localhost 22]# ls

  ls看到没有代码了,这个时候由于没有提交,服务器上还是有的。但是这个时候用svn update就不能下载到本地了。想要取消操作,可以用svn revert。

[root@localhost 22]# svn revert 22.txt

Reverted '22.txt'

6) 提交删除

 svn del 22.txt

[root@localhost 22]# svn  commit -m "deleted 22.txt"

Deleting       22/22.txt


Committed revision 5.

这个时候代码服务器上的也删掉了。

7)下载更新:

假如其他组员又更新了代码仓库,添加了22n.txt这个文本。我们可以直接在对应文件夹内使用svn update更新本地代码。

[root@localhost 22]# svn update

A    22n.txt

Updated to revision 6.

8)查看当前目录的修改历史:

[root@localhost 22]# svn log

------------------------------------------------------------------------

r6 | hl | 2016-05-28 09:09:09 -0700 (Sat, 28 May 2016) | 1 line


22n

------------------------------------------------------------------------

r5 | hl | 2016-05-28 09:04:20 -0700 (Sat, 28 May 2016) | 1 line


deleted 22.txt

------------------------------------------------------------------------

r4 | hl | 2016-05-28 09:01:30 -0700 (Sat, 28 May 2016) | 1 line


added version2 for 22.txt

------------------------------------------------------------------------

r3 | hl | 2016-05-28 08:18:23 -0700 (Sat, 28 May 2016) | 1 line


create 22 for gg

------------------------------------------------------------------------