SVN 学习笔记

参考:html

  SVN教程 https://www.runoob.com/svn/svn-tutorial.htmlgit

 

1. SVN 的一些概念程序员

repository(源代码库):源代码统一存放的地方
Checkout(提取):当你手上没有源代码的时候,你须要从repository checkout一份
Commit(提交):当你已经修改了代码,你就须要Commit到repository
Update (更新):当你已经Checkout了一份源代码, Update一下你就能够和Repository上的源代码同步,你手上的代码就会有最新的变动。
update 操做是用来更新版本库的。这个操做将工做副本与版本库进行同步。ubuntu

  平常开发过程其实就是这样的(假设你已经Checkout而且已经工做了几天):Update(得到最新的代码) -->做出本身的修改并调试成功 --> Commit(你们就能够看到你的修改了) 。服务器

  若是两个程序员同时修改了同一个文件呢, SVN 能够合并这两个程序员的改动,实际上SVN管理源代码是以行为单位的,就是说两个程序员只要不是修改了同一行程序,SVN都会自动合并两种修改。若是是同一行,SVN 会提示文件 Conflict, 冲突,须要手动确认。
SVN 的主要功能svn


2. 相关笔记测试

svn copy 是用来建立分支的,例如# svn copy trunk/ branches/my_branch

svn 中应该 commit 就是提交到远程版本中,至关于git push。spa

svn 中一旦一个文件使用 svn add 添加到 svn 中,以后修改这个文件后直接 svn commit 便可,不须要再执行 svn add 此文件了,这点和git不一样。调试

svn update 应该是至关于 git pullcode

svn 的操做流程应该是: svn update ---> 修改 ---> svn commit


3. 试验

建立SVN版本库"proper_1"/home/ubuntu/mytest/svn_test# svnadmin create proper_1

checkout一个版本库的副本:
/home/ubuntu/mytest/svn_test/client1# svn checkout file:///home/ubuntu/mytest/svn_test/proper_1
//这里使用的是文件协议,实际使用中能够将其替换为远程服务器上的版本库


测试添加文件
/home/ubuntu/mytest/svn_test/client1/proper_1# touch first.txt

/home/ubuntu/mytest/svn_test/client1/proper_1# echo hello > first.txt

/home/ubuntu/mytest/svn_test/client1/proper_1# svn status 
?       first.txt

/home/ubuntu/mytest/svn_test/client1/proper_1# svn add first.txt
A         first.txt

/home/ubuntu/mytest/svn_test/client1/proper_1# svn commit -m "add file: first.txt"
Adding         first.txt
Transmitting file data .
Committed revision 1.

/home/ubuntu/mytest/svn_test/client1/proper_1# svn log
------------------------------------------------------------------------
r1 | root | 2019-06-22 21:53:26 +0800 (Sat, 22 Jun 2019) | 1 line

add file: first.txt
------------------------------------------------------------------------
相关文章
相关标签/搜索