yum install -y subversion #yum install
In the compilation and installation of SVN installation chapter, the linux machine has been tested as a client
[root@localhost ~]# svnserve -d -r /home/svn-repo/ #Start a large warehouse, why start a large warehouse because you can build a small warehouse below, you don't need to start multiple at the same time,
ps –ef|grep svn Check that if it is already started, you don’t need to start it again
[root@localhost svn-repo]# svnadmin create /home/svn-repo/wind #Create a small warehouse wind client test
conf #config
authz #Edit the authority control file authz, divide groups, add users to groups and authorize
passwd #Add access user and corresponding password
svnserve.conf # Warehouse configuration file access modification
db #Save the submitted code
hhooks #implement advanced functions
locks #locked files
[root@localhost conf]# vim /home/svn-repo/wind/conf/svnserve.conf #Set up anonymous access first, then test it later, the modification will take effect without restarting
anonymous test
new file test
1. Join (add)
2. Submit (conmoit)
3. Notes
delete test
Check it out again
normal test
Anonymous in the above test
账号密码测试>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1. Edit the account password file passwd, add the access user and the corresponding password
[root@localhost ~]# vim /home/svn-repo/wind/conf/passwd
2. Edit the permission control file authz, divide groups, add users to groups and authorize
vim /home/svn-repo/wind/conf/authz
Configured under [groups] is a list of group = group user 1, group user 2, indicating which users are in each group
[/]: The root directory here refers to the project root directory, not the system root directory
@g_admin = rw: Indicates the permissions of the g_admin group, where r means read and w means write, that is, the group has read and write permissions to the project root directory
[/dev]
@g_dev = rw
Indicates that the g_dev group has read and write permissions to files in the dev directory under the root directory
3. Edit the service configuration file to enable users and policies to take effect
[root@localhost ~]# vim /home/svn-repo/wind/conf/svnserve.conf
The above configuration items are described as follows:
[general]
anon-access=none #Do not allow anonymous users to access
auth-access = write #Authenticated users can read and write, users in passwd.conf
password-db = /var/svn/lemon/conf/passwd #User save file
authz-db = /var/svn/lemon/conf/authz #authority management file
realm = lemon#Authentication space name, the directory where the repository is located
5. Check out at wind
Login with account and password
The following test is the same as the anonymous test above
Installation instructions: The following is the account password test:
Developers strongly recommend using the SVN plugin in the IDE to be more intelligent and user-friendly.
First install the SVN client. Windows generally choose the turtle client https://tortoisesvn.net/downloads.html .
Select the corresponding client to install according to the number of system bits.
If you like to use the command line, please remember to check command line client tool
as will be install on local hard driver
, skip this step without the command line.
Then all the way to next can be installed. After installation, right-click anywhere to view the shortcut menu. If found TortoiseSVN
, the installation is successful.
If the installation command line tool is checked, then enter the command SVN, and the following prompt also indicates that the installation is successful
But the menus are all in English at this time. If you are not used to English, you can download the language pack and remember to check the system digits.
After installing the language pack, you can right-click to enter the setting
settings.
Select the language you like (such as Chinese), and then confirm, no accident, the language has now been switched to Chinese.
This is the end of the installation tutorial. Let's start to introduce the use of SVN.
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.
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.
Next, just write the code and submit it.
Deleted files should also be right-clicked and submitted, as follows.
Remember to check the status of your files at any time, and if they are not added to version control, add them in time, otherwise your files will not be submitted.
renew
Suppose you and classmate B are collaborating. After classmate B wrote the code and submitted it to SVN, if you want to get the latest modification, you need to select update (if there are new ones submitted by others on the server, you cannot submit them, you must update them before submitting).
How do I know if the server has been updated? You can directly choose to update, and you will know if there is an update. Or right-click to check for changes, and then check the repository to see which files have been changed on the server.
Right-click and select HEAD and BASE to compare.
The one on the left represents your code, and the one on the right represents the code on the server.
If there are changes, remember to update to the local in time and then continue to work.
But sometimes the update will conflict, for example, you and the server have changed the same place.
At this point you need to update to resolve the conflict.
It will prompt you which file is in conflict, you just need to open that file and resolve the conflict as required.
<<<<<<.mine to ==== for your code, others for the server's code. You just change to what you want.
Then select Resolve and tell SVN that I have resolved the conflict.
The rest is the update submission operation between team collaborations, which will not be repeated here.
View logs
Choose to show the log, you can see what the people in the team have done.
You can see who is who, what time, and what. The last column of information was written when I submitted it myself. It is recommended that you fill in the submission information when submitting, so that others can see what you have done. Submitting information is also good for you, and you can see what you did after a long time.
version rollback
If you change something, but haven't committed it yet, you can use the revert feature.
But what if we wrote something wrong and committed it? A file can be restored to a
previous version with version rollback. Right-click to update to the version, select the version by viewing the log, and then roll back.
Sometimes we need to look at previous versions of the code. At this point we can create a new folder to check out to the specified version.
version control
There are several methods of version control, as follows.
-
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), don't delusional SVN can 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.