1.还原到某个版本
svn up -r 版本号
svn up -r 版本号 文件名称
2. 还原改动
对应提交(commit),要有类似回滚(rollback)的操作。
svn revert file_path
或者通过tortoiseSVN,eclipse插件。
这个操作对开发人员十分有用,在改动被人很多代码后可以“一键恢复”。
3. “还原”已提交的改动
revert只适合未提交的情况。
如果已经提交,发现问题,要回退到之前的修订版。
首先需要:
svn up
让本地工作拷贝更新到最新状态。
然后:
svn log your_file_path
查看文件日志,这时候提交时填写的说明信息就派上用场了。
查看两个修订版之间的不同:
svn diff -r 旧修订版序号:新修订版序号 your_file_path
或者通过tortoiseSVN,eclipse插件。
决定用哪个旧的修订版号后,用旧的修订版号文件覆盖新的修订版号文件。
svn merge -r 新修订版序号:旧修订版序号 your_file_path
还需要:
svn commit -m “恢复到某修订版(某修订版作废)”
这个还原是所谓的,不是用旧的版本号替代,而是将旧文件覆盖新文件。
常用命令:
svnadmin create your_project_folder 建立文件库
mkdir you -p 创建文件夹
svn import path_to_existing_files file://full_path_to_project_folder/trunk/ -m "Initial import" 导入文件
pwd 查看当前路径
svn update 更新
ls -a 简短列出目录下全部文件
svn commit button.c 提交单个文件
svn status 查看当前目录svn中的全部文件状态
svn status (also known as stat, st)
Print the status of working copy files and directories.
svn status path...
With no args, print only locally modified items (no network access).
With -u, add working revision and server out-of-date information.
With -v, print full revision information on every item.
The first five columns in the output are each one character wide.
First column: Says if item was added, deleted, or otherwise changed.
“ ” No modifications.
A Added.
C Conflicted.
D Deleted.
G Merged.
I Ignored.
M Modified.
R Replaced.
X Item is unversioned, but is used by an externals definition.
? Item is not under version control.
! Item is missing (removed by non-svn command) or incomplete.
˜ Versioned item obstructed by some item of a different kind.
Second column: Modifications of a file’s or directory’s properties.
“ ” No modifications.
C Conflicted.
M Modified.
Third column: Whether the working copy directory is locked.
“ ” Not locked.
L Locked.
Prepared exclusively
Fourth column: Scheduled commit will contain addition with history.
“ ” No history scheduled with commit.
+ History scheduled with commit.
Fifth column: Whether the item is switched relative to its parent.
“ ” Normal.
S Switched.
The out-of-date information appears in the eighth column (with -u).
* A newer revision exists on the server.
“ ” The working copy is up-to-date.
The remaining fields are variable width and delimited by spaces: the
working revision (with -u or -v), the last-committed revision, and lastcommitted
author (with -v). The working copy path is always the final
field, so it can include spaces.
svn 回复和常用命令
原创
©著作权归作者所有:来自51CTO博客作者lisiben的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Docker 常用命令
docker常用命令;包含image、container、network、volume、dockerfile、compose file等常用操作
docker image container network -
SVN常用命令汇总
vn版本控制工具在开发中用的越来越多,很多人对一些命令一知半解,本文将介绍开发用到的常用命令。废话少说,查看svn 有哪些命令:
开发工具 svn JavaScript 服务器技术 Javaweb -
Svn 服务配置和维护常用命令
Subversion独立服务安装;Subversion服务与apache 整合
apache 服务 其他 休闲 Subversion