svn Novice Guide

 

This article Reference: https: //www.jianshu.com/p/aab539536572, but modifications to the installation instructions, and the intermediate operation instructions.

 

Contents are as follows:

Installation
Instructions
detection project
import project
submitted
updated
view the log
version rollback
versioning
summary

Installation Notes

Developers strongly recommend the use of more intelligent and humane SVN IDE plug-in (that is to say some IDE comes with svn, no need to install anything!).

First, install the SVN client (including Chinese patch), I chose the Free Software Park, this is a very conscience of the site not only has the resources and will teach you how to download and simple to use:

Address: http: //www.onlinedown.net/ 

 

Second, choose the right version, we generally use a 64-bit computer, so you can select the first

 

Then follow his course to go down the line, installation is very simple not to say

This concludes the installation, the following began to introduce the use of SVN.


Instructions for use

Detection project


If the project is already in the server's warehouse, so now you have to do is put it detected locally.
First, create an empty folder (named have meaning!). In an empty folder, right, select SVN detected.

 

 

Now you should see this screen, fill in the address of the repository, select OK.

 

 

Will pop up a dialog box that lets you enter the account password, enter your account password. Remember to check the Save authentication, or each operation will let you enter.

 

 

 

Wait a few minutes can be detected is completed.

 

 

 

At this point in your directory will be able to see your project, now you can start a pleasant work.

 

 

But there may be a permissions problem encountered pit

 

At this point there are two possibilities:

First, the current account is not configured with the appropriate permissions in svn repository, then add the appropriate rights to in the configuration file.
Second, the configuration of the authority, but the current user does not, at this time may be as follows:

在文件夹里点右键,选择TortoiseSVN->Setings->SavedData
里面有个authentication data,点击后面的Clear就好了
下次有什么动作会提示你输入用户名和密码


导入项目


但是有时候你已经在本地建立好了项目,需要把你项目推到SVN上,此时应怎么做呢?
右键选择版本库浏览器。

 

 

在相应目录下,右键,加入文件/加入文件夹,选择相应目录即可。

 

比如我现在有个项目叫SVNProject,我想把它传到SVN上。

 

那么我只需选择加入文件夹即可。

 

务必要输入提交信息。这样别人才能知道你干了什么。

 

导入成功就能看到目录。

 

 

但是,不要以为导入成功就可以了。你还得重新检出,重新检出的项目才是受SVN控制的,务必记得检出。

 

 

在SVNProject上右键检出到本地,然后在里面进行修改。现在就可以愉快的工作了。
检出过后的右键菜单变成了这样。

 

 

提交


绿色表示当前文件没有被修改过(看不见颜色的重启下电脑就好了,也可以不这样可以重新进入目录)。

 

 

假如我现在在我是新项目.txt中加了一行字,然后保存。

 

 

 

image_1ak3g7ct21svq1lrejruu6e16okm.png-6.1kB

发现现在变成了红色,红色表示已修改。

 

 

image_1ak3g9vfl1rqc1mvb19s81hg1t3913.png-4.9kB

怎么提交修改?
在本地目录下,右键选择提交。

 

 

 

image_1ak3gdc7j17dt1n50d1l8e1trp1g.png-25.2kB

务必记得输入提交信息(虽然不输入也能提交),提交信息可以方便日后查看。

 

 

提交完毕后,可以发现又恢复到了绿色。

 

假如现在加入了一个新文件。可以看出是蓝色的。蓝色表示不属于版本库的未知文件,未知文件是不能提交的。

 

 

 

记住选择增加把它加入到版本库里面去。

 

 

 

增加完毕后,变成了蓝色加号,表示新增

 

 

image_1ak3h5j9j1j4cnfhhq2vv2lba41.png-4.3kB

接下来,只需写代码,然后提交即可。
删除文件也应该右键提交,如下。

 

 

 

image_1ak3hcqrakda18mc5pg1dlke4d4e.png-57.7kB

记得随时检查你的文件状态,如果没有添加到版本控制里要及时添加进去,不然你的文件提交不上去。


更新


假如你和B同学在协作。B同学写完代码提交到了SVN上,如果你想获取最新修改,就需要选择更新(如果服务器上已经有别人提交过的新的,你是提交不上去的,必须先更新再提交)。
怎么知道服务器有没有更新?你可以直接选择更新,有没有更新一下就知道。或者右键检查修改,然后检查版本库,就能看到服务器上改了哪些文件。

 

 

image_1ak3i1mon1f871qr9178eds61qoq4r.png-100.3kB

右键选择HEAD和BASE比较。

 

 

image_1ak3i7ql4mre1t6e17r717o81nlq58.png-22.9kB

左边的表示你的代码,右边的表示服务器上的代码。

 

 

image_1ak3i9ado1p6cv6aoh460210it5l.png-117.7kB

如果有修改记得及时更新到本地然后再继续工作。
但是有时候更新会冲突,比如你和服务器上的改了同一个地方。
这时候你需要更新下来解决冲突。

 

 

image_1ak3ihv861ceq1gko16jl1uu3mqe62.png-68.8kB

它会提示你哪个文件冲突,你只需打开那个文件,按照需求解决冲突即可。

 

 

image_1ak3ikl7a1c9dmk619r9d371mui6f.png-11.4kB

<<<<<<.mine到====表示你的代码,其他表示服务器的代码。你只需改成你想要的。

 

 

image_1ak3iojkm7ic6911jr39021qk46s.png-5.1kB

然后选择解决,告诉SVN我已经解决冲突了就行了。

 

 

 

 

image_1ak3itj8gt8315rf1flij6k1l1979.png-41.3kB

剩下的就是团队协作间的更新提交操作,这里不做赘述。


查看日志


选择显示日志,可以看出团队里面的人干了什么。

 

 

image_1ak3j48bv6r9tnm821u3gpjn7m.png-30kB

可以看出谁谁谁,什么时间,干了什么事。最后那一列信息是自己提交的时候写的。建议大家提交时务必要填写提交信息,这样别人一看就知道你干了什么。提交信息对于自己也是有好处的,时间长了也能看到当初做了什么。

 

 

image_1ak3j7va3jbt147j1s2thni1eui83.png-98.6kB

版本回滚


如果你改了东西,但是还没有提交,可以使用还原功能。

 

image_1ak4pcd3bpac328t5u1mas1k1v9.png-103kB

但是如果我们写错了东西并且提交了上去怎么办?通过版本回滚可以将文件恢复到
以前的版本。右键更新至版本,通过查看日志来选择版本,然后回滚即可。

 

 

image_1ak3k9pl5nt0euj10eob6e1pai8t.png-21.1kB

有时候我们需要查看以前版本的代码。此时我们可以新建个文件夹检出到指定版本。

 

image_1ak3kifgr1b1q1fv0p871f25jda9a.png-158.9kB

版本控制


版本控制有好几种方法,如下。


在提交发布版本时添加版本信息,这是最简单的一种方法。

 

 

 


image_1ak3locvo1ndq4pg1nohuhn1fh89n.png-17.1kB

打标签  


每次发布版本时应该打标签。右键选择分支/标记。在至路径以版本号打上标签即可

 

 

 


image_1ak3muiav1t0o9v21a5qfnt3ut9.png-28.3kB

 

image_1ak4tm0e3aal1t71r94p941h9p2a.png-80kB

这样你就有了一个v1.0版本的标签。
以后如果你想查看某个版本的代码,只需切换过去就行

 

image_1ak3n7ai51l6b77j10811plc12ba13.png-14.9kB

总结


我们在日常使用中,最常用的是更新和提交操作。这两个步骤务必要非常熟练。其他的可以在遇到问题是查看文档。此外,需要注意的是,所有版本控制工具只能跟踪文本文件(能用记事本打开查看的文件),不要妄想SVN能记录你word改了哪一行。一旦遇到word冲突,记住仔细对比两个版本,然后解决冲突。

 

Guess you like

Origin www.cnblogs.com/lichenghong/p/11357241.html