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.
Now you see this interface, fill in the repository address, and select OK.
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.
Check out in a few minutes.
At this point you can see your project in your directory, and now you can start working happily.
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.
In the corresponding directory, right-click, add file/add folder, and select the corresponding directory.
。
For example, I now have a project called SVNProject, and I want to upload it to SVN.
Then I just choose to join the folder.
Be sure to enter submission information. So others can know what you did.
After the import is successful, you can see the directory.
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.
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.
submit
Green indicates that the current file has not been modified (restart the computer if you cannot see the color).
Suppose I now 我是新项目.txt
add a line of words in and save it.
The discovery is now red, which means it has been modified.
How to submit changes?
In the root directory, right-click and select Submit.
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.
After the submission is complete, it can be found that it has returned to green.
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.
Remember to select Add to add it to the repository.
After the addition is complete, it becomes a blue plus sign, indicating the newly added version library file.
接下来,只需写代码,然后提交即可。
删除文件也应该右键提交,如下。
记得随时检查你的文件状态,如果没有添加到版本控制里要及时添加进去,不然你的文件提交不上去。
更新
假如你和B同学在协作。B同学写完代码提交到了SVN上,如果你想获取最新修改,就需要选择更新(如果服务器上已经有别人提交过的新的,你是提交不上去的,必须先更新再提交)。
怎么知道服务器有没有更新?你可以直接选择更新,有没有更新一下就知道。或者右键检查修改,然后检查版本库,就能看到服务器上改了哪些文件。
右键选择HEAD和BASE比较。
左边的表示你的代码,右边的表示服务器上的代码。
如果有修改记得及时更新到本地然后再继续工作。
但是有时候更新会冲突,比如你和服务器上的改了同一个地方。
这时候你需要更新下来解决冲突。
它会提示你哪个文件冲突,你只需打开那个文件,按照需求解决冲突即可。
<<<<<<.mine到====表示你的代码,其他表示服务器的代码。你只需改成你想要的。
然后选择解决,告诉SVN我已经解决冲突了就行了。
剩下的就是团队协作间的更新提交操作,这里不做赘述。
查看日志
选择显示日志,可以看出团队里面的人干了什么。
可以看出谁谁谁,什么时间,干了什么事。最后那一列信息是自己提交的时候写的。建议大家提交时务必要填写提交信息,这样别人一看就知道你干了什么。提交信息对于自己也是有好处的,时间长了也能看到当初做了什么。
版本回滚
如果你改了东西,但是还没有提交,可以使用还原功能。
但是如果我们写错了东西并且提交了上去怎么办?通过版本回滚可以将文件恢复到
以前的版本。右键更新至版本,通过查看日志来选择版本,然后回滚即可。
有时候我们需要查看以前版本的代码。此时我们可以新建个文件夹检出到指定版本。
版本控制
版本控制有好几种方法,如下。
This is the easiest way to add version information when submitting a release build.
Tagging should be tagged
every time a version is released. Right click and select branch/tag. Label the to path with the version number
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
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.