[DEV] SVN常用命令

svn官網 http://subversion.apache.org/

svn help xxx 查看命令幫助

 

1.無分支流程

svn co http://.../trunk 獲取代碼

cd trunk 進行開發

svn st(文件級別)查看本地與緩存版本差異

svn log -v url (文件級別) 比較線上更新

svn diff (代碼級別)比較A/B差異,如svn diff -r head比較線上更新

svn ci trunk -m "" 提交代碼

svn update 更新本地

其他:目錄複製後,刪除複製出的目錄下.svn,以避免異常

 

2.有分支流程

相對於無分支流程下的svn ci,有分支流程分解爲主幹到分支、分支到主幹的過程,還可以進行多任務並行開發(最後merge)。

usage:   1. merge SOURCE[@REV] [TARGET_WCPATH] (the 'complete' merge)

              2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH] (the 'cherry-pick' merge)

              3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH] (the '2-URL' merge)

              1全體合併;2截段合併;3多支合併。

src/tar:svn merge SOURCE[@REV] [TARGET_WCPATH]. SOURCE is usually a URL, TARGET_WCPATH is a working copy path. Normally SOURCE and TARGET_WCPATH should each correspond to the root of a branch.

REV:SOURCE is usually a URL. The optional '@REV' specifies both the peg revision of the URL and the latest revision that will be considered for merging; if REV is not specified, the HEAD revision is assumed. If SOURCE is a working copy path, the corresponding URL of the path is used, and the default value of 'REV' is the base revision (usually the revision last updated to).

catch-up/reintegrate:A merge from the parent branch to the feature branch is called a 'sync' or 'catch-up' merge, and a merge from the feature branch to the parent branch is called a 'reintegrate' merge.

issue:if merge r1:r2,but tar is already r2+1 (衝突檢測與解決,r2=head is better)

 

1)創建分支,獲取分支,進行開發,查看修改,提交修改到分支

    svn cp http://.../trunk  http://.../branch/brch_name -m ""

    svn co http://.../branch/brch_name

    cd brch_name

    svn st、diff

    svn ci brch_name -m ""

2)更新主幹到分支

    查看版本,cd branch,svn log --stop-on-copy,最後一條記錄就是創建分支時的版本

    (參考 http://zccst.iteye.com/blog/1430823)

    svn merge -r v1:v2 http://.../trunk

    (v1: version on copy, v2: latest version as HEAD,e.g. svn merge -27:HEAD http://.../trunk)

    svn status、diff

    svn ci brch_name -m ""

3)合併分支到主幹

    cd trunk

    svn merge -r v1:v2 http://.../branches/brch_name

    svn status、diff

    svn ci trunk -m ""

4)維護分支

    更新分支,即繼續步驟(2)

    或刪除分支,svn rm http://.../branch/brch_name

5)建立tags,發佈版本

    svn copy http://.../trunk http://.../tags/release-1.0 -m "1.0 released"

 

參考鏈接

https://blog.csdn.net/bbirdsky/article/details/24620155

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章