代码管理:SVN的使用
SVN是一种代码托管的工具,它虽然没有GIT那么先进,但是历史悠久,目前很多代码备份和托管依然使用了SVN的方式,因为所在机构的服务器上就有SVN,所以需要学习一下。这里讲的操作主要是针对Linux,Windows下有个比较傻瓜的小软件,tortoise SVN,用起来很简单,就不赘言了。
使用前需要知道所在机构的SVN服务器的网址:
- 常见命令
-
add
svn add file.type
This command will add the local file into svn version control, then you can use svn commit to upload it to svn server. -
blame (praise, annotate, ann)
-
cat
-
changelist (cl)
-
checkout (co)
svn checkout path(http path of the linux server) (name change)% checkout(download) files from svn server
notice: all the files will be downloaded to your current directory, so make sure to use cd to change the current directory to your desired place -
cleanup
-
commit (ci)
% update local file change to svn server
svn commit filechagne.typ -m 'comment'
The condition to do svn commit is that you have checkout the file in local directory form svn server. -
copy (cp)
-
delete (del, remove, rm)
% this command will delete a single file or a whole directory in svn server
svn remove -m 'comments' http://svn.directory/.../file.type % which will remove a single file
svn remove -m 'comments' http://svn.directory/.../directory/ % which will remove this directory -
diff (di)
-
export
-
help (?, h)*
svn --help % show the svn help, it will list many help command. -
import
% this command will upload new file to the svn server
svn import -m 'comment' file.type http://svn.directory/.../file.type % this will add the file in svn server, be careful about the last file name, do not misspell it, or your file will have a wrong name.
svn import -m "comments" . http://serverpath/currentdirectory% this command will upload the current directory to svn(containing all files)
*info
*list (ls)
*lock
*log
*merge
*mergeinfo
*mkdir
% this command will make a new directory in the svn server.
svn mkdir -m 'comments' http://svn.directory/.../newdirectory
*move (mv, rename, ren)
*propdel (pdel, pd)
*propedit (pedit, pe)
*propget (pget, pg)
*proplist (plist, pl)
*propset (pset, ps)
*resolve
*resolved
*revert
*status (stat, st)
*switch (sw)
*unlock
*update (up)
svn update
svn update % this command will update all the file and related directory from server to the local directory,
% which is to say the files on the server are not changed and only the local file is changed.
[http://wiki.greenstone.org/wiki/index.php/Useful_SVN_Commands reference: Greenstonewiki_svn_commmands]