參考: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 ------------------------------------------------------------------------