查看状态
svn st
# 未添加到svn
? a.txt
# 已经添加,未提交
A b.txt
添加文件
添加单个文件
svn add
添加所有文件
svn add .
--force
递归到版本化的目录
svn add . --force
查看信息
svn info
路径: .
工作副本根目录: /home/wukuy/桌面/code/my/test
URL: svn://localhost/test/trunk_1
Relative URL: ^/trunk_1
版本库根: svn://localhost/test
版本库 UUID: ff6976ee-91df-46f7-9949-4345a31a5bc3
版本: 3
节点种类: 目录
调度: 正常
最后修改的作者: wukuy
最后修改的版本: 3
最后修改的时间: 2019-05-10 14:34:46 +0800 (五, 2019-05-10)
提交
单个文件提交
svn commit -m '第一次提交' b.txt
提交当前目录下所有修改的文件
svn commit -m '第一次提交'
创建分支
svn cp -m "创建分支" svn://localhost/test/trunk/project svn://localhost/test/branches/project_v1.0.1
分支拉取主干最新代码
cd
到分支执行
svn merge svn://localhost/test/trunk/project
Select: (1) use their version, (2) use your version,
(12) their version first, then yours,
(21) your version first, then theirs,
(e1) edit their version and use the result,
(e2) edit your version and use the result,
(eb) edit both versions and use the result,
(p) postpone this conflicting section leaving conflict markers,
(a) abort file merge and return to main menu: 2
“a.js”的合并完成。
选择: (p) Postpone, (df) Show diff, (e) Edit file, (m) Merge,
(r) Mark as resolved, (s) Show all options: r
svn revert *
不能再次svn merge
$ svn st
M .
$ svn revert .
已恢复“.”
因为.
没有撤销修改
分支合并到主干
cd
到主干执行
svn merge --reintegrate svn://localhost/test/branches/project_v1.0.1/
删除分支
svn rm svn://localhost/test/branches/project_v1.0.1/ -m ''
svn log
查看最近提交
svn log | head -n 10
祖父关系(分支合主干)
# 切到分支
svn sw --ignore-ancestry svnURl
#切回主干
svn sw --ignore-ancestry svnURl
# 合并分支
svn merge --reintegrate svn://localhost/test/branches/project_v1.0.1/