SVN use (3) - instructions for use

Check out an item

If the project is already in the server's repository, all you have to do now is to check it out locally. 
First create an empty folder. Right-click in an empty folder and select SVN Checkout.

image_1ak3do46q18kl1l79c9u4pu1mdd3h.png-21.5kB

Now you see this interface, fill in the repository address, and select OK.

image_1ak3dsjn6ha81ojlg2a1b1h67o3u.png-40.8kB

A dialog box will pop up for you to enter your account password, just enter your account password. Remember to tick Save Authentication, otherwise you will be asked to enter every time you operate.

image_1ak3e0eesor01kg616s81aj11h524b.png-21.5kB

Check out in a few minutes.

image_1ak3e38931rr19dg1cbd1t8pn3g4o.png-51.4kB

At this point you can see your project in your directory, and now you can start working happily.

image_1ak3e6ja4gnsvep1oaluia2pp55.png-5.3kB

import project

But sometimes you have already built a project locally and need to push your project to SVN. What should you do at this time? 
Right-click and select Repository Browser.

image_1ak3eopb116i6192u14i4c7r1avu6c.png-101kB

In the corresponding directory, right-click, add file/add folder, and select the corresponding directory.

image_1ak3etni4fba1oi017rv1u6m1gn16p.png-116kB

For example, I now have a project called SVNProject, and I want to upload it to SVN.

image_1ak3f04bl1k5q1qmrrcmu4m1j2j76.png-50.7kB

Then I just choose to join the folder.

image_1ak3f5l6f1h8f1rimgee1544sdc7j.png-35kB

Be sure to enter submission information. So others can know what you did.

image_1ak3f7oe71gs6mkdlucdrrqq880.png-31.7kB

After the import is successful, you can see the directory.

image_1ak3fbqo13gu1uji53ku5g1bs68d.png-110.6kB

However, don't assume that the import is successful and that's it. You have to check out again, the re-checked out project is controlled by SVN, be sure to remember to check out.

image_1ak3fghhcg9fk9oab61n5q1sqg8q.png-110.6kB

Right-click on SVNProject to check out to the local, and then modify it inside. Now you can work happily. 
The right-click menu after checking out becomes like this.

image_1ak3fnbnn1ber1u0k1hbs1ti6ovi97.png-24.4kB

submit

Green indicates that the current file has not been modified (restart the computer if you cannot see the color).

image_1ak3g3u171j9j1r40mbp1hkv12ju9.png-4.1kB

Suppose I now 我是新项目.txtadd a line of words in and save it.

image_1ak3g7ct21svq1lrejruu6e16okm.png-6.1kB

The discovery is now red, which means it has been modified.

image_1ak3g9vfl1rqc1mvb19s81hg1t3913.png-4.9kB

How to submit changes? 
In the root directory, right-click and select Submit.

image_1ak3gdc7j17dt1n50d1l8e1trp1g.png-25.2kB

Be sure to remember to enter the submission information (although you can submit it without entering it), the submission information can be easily viewed in the future.

image_1ak3gif5h13l11rfmorm87g5a71t.png-74kB

After the submission is complete, it can be found that it has returned to green.

image_1ak3gngr3o2amk41abkod91ogi2a.png-5kB

Suppose now that a new file is added. It can be seen to be blue. Blue indicates unknown files that do not belong to the repository, and unknown files cannot be submitted.

image_1ak3grpb5hgbs62sj4tthfql2n.png-11.6kB

Remember to select Add to add it to the repository.

image_1ak3h1boe1njh1dhrhu1bjr1t333k.png-50.7kB

After the addition is complete, it becomes a blue plus sign, indicating the newly added version library file.

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

版本控制

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

  1. This is the easiest way to add version information when submitting a release build. 
    image_1ak3locvo1ndq4pg1nohuhn1fh89n.png-17.1kB

  2. Tagging should be tagged 
    every time a version is released. Right click and select branch/tag. Label the to path with the version number 
    image_1ak3muiav1t0o9v21a5qfnt3ut9.png-28.3kB 
    image_1ak4tm0e3aal1t71r94p941h9p2a.png-80kB 
    so you have a v1.0 version label. 
    If you want to view a certain version of the code in the future, just switch to the past 
    image_1ak3n7ai51l6b77j10811plc12ba13.png-14.9kB

Summarize

In our daily use, the most commonly used are update and commit operations. These two steps must be very skilled. The other thing you can do when you run into problems is to look at the documentation. In addition, it should be noted that all version control tools can only track text files (files that can be opened and viewed with Notepad), and don't expect SVN to record which line you changed in word. Once you encounter a word conflict, remember to carefully compare the two versions, and then resolve the conflict.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324890902&siteId=291194637