SVN Beginner Usage Instructions

Source: Internet
Author: User
Tags commit parent directory svn svn update what subversion server port version control system tortoisesvn

Work in the process to learn SVN, so today specialized search information, written here is also let oneself later back can look.

About SVN:

why use SVN.

Programmers in the process of writing a program, each programmer will generate a lot of different versions, which requires the programmer to effectively manage the code, when needed, can be quickly and accurately remove the corresponding version.

what subversion is.

It is a free/open source version control system, a set of files stored in the central repository, record every file and directory changes, Subversion allows to restore the data to an earlier version, or check the history of data modification, subversion can access its repository through the network, This allows the user to operate on different computers.

One: SVN server build and use.

1. First to download and build the SVN server, download the address as follows: Http://, after entering the URL, scroll to the bottom of the browser to see the following screenshot:

Personally, it is best to use VISUALSVN server servers and TORTOISESVN clients. Click on the VISUALSVN connection above, download VISUALSVN server, download the completed double-click Installation, as shown below:

Click Next Next, as follows:

Then click Next, Next, as follows:

Click "Next" below:

Location refers to the VISUALSVN server's installation directory, Repositorys is specifying your repository directory. Server port specifies a port, and use secure connection Shan represents a secure connection.

Click Next to proceed to the next step, as shown below:

Then click "Install" to enter the following installation diagram:

After waiting for the installation to complete, click "Next" and proceed to the next step: figure below

Click "Finish" to complete the installation. After the installation is complete, start VisualSVN Server Manager, as shown in figure:

You can see some information about the repository on the right side of the window, such as status, logs, user authentication, repository, etc.

To build the repository, you need to right-click the repositores in the left window, as shown below:

In the popup context menu, choose Create New Repository or create new->repository:

Go to the next step, as shown below:

Click "Next", as shown below:

Click "Create", as shown below:

Click "Finish" to complete the basic creation.

2. Users and groups need to be established, and permissions need to be assigned .

1. Right-click the user group on the left side of the VisualSVN Server Manager window, select Create User or create a new->user, as shown in figure:

After clicking on user, enter the following image:

After filling in username and password, click the OK button to enter the following image:

Click the "ADD" button above and the image below

Add longen0707 to the user (if there are multiple users, the same action).

2. Then we set up the user group, right-click the user group on the left side of the VisualSVN Server Manager window, select Create Group or create a new->group, as shown in the figure:

After clicking the "Group" button, enter the following image:

In the pop-up window, fill in the group name as developers, then click the Add button, select Developer in the pop-up window, add to the set, then click OK.

Next we need to set permissions for the user group, right-click on Myrepository, select Properties, as shown in figure:

In the dialog box that pops up, select the Security tab, click the Add button, select longen0707, and then add it, with the permissions set to Read/write, as shown in the following image:

Click on the "OK" button.

Two: Client SVN installation.

1. First we need to download "svn Little Turtle" after the installation. For example I downloaded the following:

After the installation is complete, for example, in my project in qiandaun1, I can right-click to see the following:

Indicates that the SNV has been installed successfully.

2:checkout the project file.

New or entered directory (e.g. Qianduan1), right---Svn Checkout--

Where the URL I can get from the SVN server, I right-click on the new file under Myrepositories

The Qianduan file is built, and then like me right---copy under


Paste the copied repository URL on the following image:

Click "OK" button, you can retrieve it, as follows:

The following figure:

Precautions :

. SVN this hidden directory records two key messages: The baseline version of the working file and the timestamp of the last update of a local copy, and never manually modify or delete this. SVN hides the directory and the files inside!!, otherwise it will cause your local working copy (static attempt) to be destroyed, No further action is possible.

1) TortoiseSVN icon Introduction

A newly checked work copy uses a green checkmark overload to indicate that the subversion status is normal.

After you start editing a file, the state becomes modified, and the icon reload becomes a red exclamation point. In this way, you can easily see that those files have been modified since you last updated the working copy and need to be submitted.

If a conflict occurs during the commit process, the icon becomes a yellow exclamation mark.

The plus sign tells you that a file or directory has been scheduled to be added to version control.

2) TortoiseSVN client base operation:

1. svn Checkout (svn Checkout)

Right-click in the folder or directory –> Select SVN Checkout, as shown in the following figure

After clicking, enter the repository's directory address in the pop-up window's Repository URL box and click OK, as shown below

Then click the OK button, the following image:

Enter the user name and password in the dialog box that appears, and after verification succeeds, the project file starts to download from the remote server to the local working directory.

When you click the OK button, you can get it done, as shown in the following figure:

2. Add (ADD)

Under the test project file, create a new B.txt file, and submit it to the repository in the following 2 ways:

1. First mention the change list, then commit to the configuration library, select the new file, right-click on the SVN menu to execute the "ADD" action submitted to the "Change list", and then right-click on the SVN menu "svn commit" commit to the repository.

2. Do not submit to the list of changes, but directly in the Commit configuration library, select the file, right-click on the SVN menu to perform an "SVN Commit" operation.

3. Deletion (delete)

If the deleted file is not yet in the repository, you can delete the file directly using the operating system's delete operation.

If the deleted file is in the repository, the deletion is as follows: Select the deleted file, right-click the SVN menu to perform a "delete" action, then select the parent directory of the deleted file, and right-click on the SVN menu to execute "SVN Commit".

Delete the file using the delete operation of the operating system, then select the parent directory of the deleted file, and right-click the SVN menu to execute "SVN Commit" and select the deleted file in the change list. The following figure:

4. Renaming (Rename)

Modify the filename, select the file or folder you want to rename, then right-click "Tortoisesvnàrename", enter the new name in the dialog box that pops up, click "OK" button, and submit the file or folder after the modified file name to the SVN server via "SVN commit".

5. SVN restore (svn Revert)

Right-click the file or folder you want to fallback, and select "Update to reversion ..." in the TortoiseSVN pop-up menu. A window will then pop up, as follows:

For example, we have to go back to the 10th version only need to fill in revision the corresponding version number, and then click OK.

6. Checking for updates (check for modifications)

This feature can show that you have made the changes have not been submitted, this feature can not only see changes to the file change, all the changes can be seen, including adding files or directories, delete files or directories, moving files or directories, etc., if you click on the check repository, you can also see the version of the repository changes, You have not updated it to local, as follows:

7. SVN updates (SVN update)

Update the local code consistent with the latest version of the SVN server, simply right-click on the folder you need to update or right-click on the blank in the file, select "SVN Update" (Get the content in the specified version, right-click on "Update to reversion" in the SVN menu) , you can do it.

7.1 How to resolve conflicting files

For each conflicting file subversion placed three files in your directory: the following:

Why would a conflict code be generated? The reason is very simple is because different people, at the same time modified the same file of the same place, when he submitted, I did not submit, I will not submit, this time we have to update, and then commit, if there is a conflict, it will generate the above 3 files.

The solution is as follows :

First we can look at the 1.txt code as follows:

<<<<<<<. Mine

aaaasdf11222333 Dderderder


B>>>>>>>. R5

And then I get rid of the extra code, and 1.txt becomes this

aaaasdf11222333 Dderderder

Commits, or cannot be submitted, as follows:

Why. Because the conflict will produce the above three files, there are 3 files above the existence of the affirmation can not be submitted, the three file codes and explanations are as follows: 1.txt.mine is a pre-conflict file. You can look at the following content:

aaaasdf11222333 Dderderder

2.1.TXT.R4 is a pre-conflict local version file

The contents are as follows: aaaasdf11222333

3.1.TXT.R5 is the version that someone else has to commit before you

The contents are as follows: b

Among them, <<<<<<<<.mine ... the code between ======= is your own, and ======......>>>>>>>. R5 is the part of someone else's code that conflicts with you.

It is not difficult to understand why the conflict is such a strange thing, because you modify the same piece of code, of course, will create conflicts.

The solution is as follows: If I am now in the 1.txt conflict content is as follows:

<<<<<<<. Mine




>>>>>>>. R16
previously said <<<<<<< mine ... =======

...... The code between is the code that I modified before I produced the conflict,

======= .........>>>>>>>. R16 This middle ... The code is someone else with me conflict code part, from the above code can see Aaaaaaaaa is my colleague new, 00000 is I added later. Using the revert (rollback) operation, which indicates that the user has discarded their own update code, and then submitted directly, this time your code will be the server on the latest code, a user submitted by the new code, your code will not be committed, as follows:

Click the OK button to see the other three files are automatically deleted, 1.txt code into the following code:


That is, a user-submitted code, my own updated code needs to be copied in-person to commit a commit. If I now 3.txt generate conflict codes as follows:

<<<<<<<. Mine


3333cccccccccc3333>>>>>>>. R16

Through the 1th we know, 333333338888888888888 this content is I modified, no conflict before the content, 3333cccccccccc3333 this code is a user-submitted code, from the above learned that a user new content is CCCCCCC, And my new content is 8888888.

Then the second solution is as follows:

Select File, right-click Editconficts: This method requires the conflicting parties to negotiate after the code changes are unified before committing. Not only resolves the conflict but also ensures that the code is correct, because only one of the code is committed.

As shown in the figure above, the red part is the conflict code: theirs represents the current server-side of the latest code, mine represents its own modified code, merged represents the merged code. Right-click on the Red button to select: Use this text block can be used as the combined code

Let's talk about the situation where the important code is overwritten because of the conflict. When a conflict occurs, if the action is not correct, it can cause some code to be lost, and it is easy to restore the previous code.

Select File-Right-select Show log in this area you can see all the versions that were submitted before, find the version you want to restore right-click on the revert to this release to restore.

SVN commit (svn commit)

SVN commits the changes made in the workspace, including changes to the contents of the file, additions to the file or directory, deletion, naming, moving, and so on. As shown in the following illustration:

8. Show logs ( show log)

This feature allows you to find out who, when, and how those files in that directory were done, as shown in the following diagram:

9. Repository Browsing (repo-browser)

This feature is used to browse the library that needs to be viewed, right-click on the local folder, select Tortoisesvnàrepo-browser, enter the repository address in the popup dialog, and then enter the user name and password to see what you need to see the repository. Here you can also see who locked the files, as shown below:

Three: Create branch merge interoperate

Why you want to create a branch and merge in your project.

For example, I now project all the files on the trunk (trunk), due to changes in demand, need to add new requirements, but we have to continue to develop on the backbone, where we can create a new branch to do to increase the demand of the piece, the trunk continues to develop, and so on branch code no problem, and merge them into the trunk.

The main purpose of creating a branch is to develop parallel with the mainline without affecting the development of the mainline.

how to operate.

If I create a new folder locally, test has 2 folders trunk (store the code on the trunk) and branch (the Code on the branch), as follows:

First: Extract the code on the trunk.

Click on the trunk--right--click SVN Checkout--Pop up a dialog box, as shown in the following image:

The above URL is obtained from the server on VISUALSVN server, as follows:

Right-click Qianduan3---Copy URL to Clipboard.

The QIANDUAN3 project has the following files, as shown in the following figure:

When you finally click on the Checkout button above, you can get the code from the remote server on the trunk as follows:

Second: New branch


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.