Introduction to TortoiseSVN

Source: Internet
Author: User
Tags svn update tortoisesvn
  • 1

    Install and download the client

  • 2

    What is SVN (Subversion )?

  • 3

    Why SVN?

  • 4

    How to Create SVN Repository in Windows?

  • 5

    Create a Working directory

  • 6

    Add files and directories to Repository

  • 7

    Update files and directories

  • 8

    Update to a specific version

  • 9

    Copy files and directories

  • 10

    Create a Tag or Release

  • 11

    Quick Reference

    • 11.1

      Get (checkout) Repository

    • 11.2

      Update a file or directory

    • 11.3

      Add a file or directory

    • 11.4

      Submitted (COMMIT) modified files or directories

    • 11.5

      Copy/Tag/branch/release file or directory


Install and download the client
End
  1. Download the windows program: http://tortoisesvn.net/downloads. In general, if it is a 32-bit windows
    XP should use TortoiseSVN-1.4.x.xxxx-win32-svn-1.4.x.msi
    This file. For 64-bit operating systems, you should use the TortoiseSVN-1.4.x.xxxx-x64-svn-1.4.x.msi
    This file.
  2. Run the downloaded tortoisesvn installer to install tortoisesvn. After the installation is correct, restart the system once to ensure that tortoisesvn
    Is correct.
  3. After the installation is successful, right-click the archive administrator and you will see the following picture:

Most TortoiseSVN operations are completed by the archive administrator and right-clicking. If you have used TortoiseCVS before, you should feel very kind about this operation method.


What is SVN (Subversion )?

There is a simple but not very accurate metaphor:

SVN = Version Control + Backup Server

Simply put, you can use SVN as your backup server. Better, it helps you remember the file content uploaded to this server each time. And automatically assign a version to each change.

Generally, Repository is used to store the uploaded files. In Chinese, it is a bit like a file warehouse. However, we usually use the Repository name
Word. Basically, for the first time, we need to add a new file to put the file to Repository. Later, if you have any changes, you can upload them
In Repository, the file that has been uploaded and modified is called commit, that is, the file is submitted to SVN for modification.
Server. For each commit, SVN
Server will be assigned a new version. At the same time, the upload time is recorded. In the future, if you need to download files that have been submitted from Repository due to some factors.
You can choose to get the latest version or any previous version. If you forget the version, you can try to get the version of a certain date by memorizing it.


Why SVN?

  1. It is very important to back up work files. You never know when the hard disk on your computer will break down. According to the empirical law, coupled with the mofi theorem, bad things often occur at the most important moment. For example,
    The hard disk is completely damaged and cannot be repaired the moment before release. Therefore, backing up work data is very important. Most companies have dedicated backup mechanisms, or even remote servers.
    Backup. It is definitely safer than putting it in your computer or on a flash drive.
  2. Version control is very important. You cannot guarantee that the latest version is always correct. Most of the time, after several days of hard work, you find that you are in the wrong direction. You need to reply all the modifications to the version a few days ago. Few people can fully remember what they have modified. If version control is not completed, the worst case is to redo it all.
  3. Data synchronization between partners is also very important. Many times, apart from yourself, other partners also need your files. How can we provide our partners with the latest archives? Use e-mail? Based on experience, use
    E-mail is a poor method. At the end, I don't know which email is new. Because your latest email may have been lost as a spam. Don't forget, now
    Many e-mail software have the anti-spam function. These emails may have been processed as advertising emails. In addition, you should also know that if the general file is put in e-mail, the file
    The size will become relatively large (usually more than 4/3 times of the original size ). If it is updated once a day, I am afraid the mailbox will burst if I haven't received it for a few days!
  4. If there is no good way, backing up different versions will consume hard disk space. For example, you have a directory of 10 MB in total and use a simple archive backup. If there are 10 versions, it will become 100 MB.
    The 20 versions have 200 MB. If you do not want to back up so many versions, you must reduce the number of backups. Increasing the backup cycle will increase the risk of data loss. Delete unnecessary backup?
    Based on experience, as long as the time is prolonged, you do not know whether the version a month ago is important or not.

Can SVN help us solve the above problems? The answer is yes:

  1. SVN Repository can be a directory on your computer or a flash drive (not recommended ). Of course, it can also be a company server.
  2. SVN has a great version control mechanism. All uploaded versions are recorded for you. You can obtain the version at any time in the future. In addition, it also provides easy-to-use features such as version branch and merge.
  3. SVN allows different developers to access the same file and uses SVN Server as the file synchronization mechanism. In other words, when you have an archive update, you do not need to send the archive to your developer. Just tell him that the new version is already in SVN
    Server, ask him to go to the SVN Server to obtain the latest version. In addition, the SVN Server can automatically send emails to relevant members after you upload a new version.
  4. SVN stores files in different backup modes. That is to say, the backup will only be different. Therefore, it saves hard disk space. In addition, it can also perform differential backup for so-called non-text files.

How to Create SVN in Windows?
Repository?

If you have installed the TortoiseSVN software mentioned above, we will first tell you how to use your hard disk or flash drive as SVN
Repository storage location. If you only want to know how to access the Repository on a created SVN Server, skip this section.

Assume that you want to place Repository in the E-slot. Create an empty directory first. In the following example, a directory named svn_repo is created under the E-slot.
SVN does not limit the Repository directory name. You can create any name you like. However, we strongly recommend that you do not use a non-English file name (such as Chinese or Japanese ).

By using your archive administrator, right-click the Icon in E:/svn_repo and choose TortoiseSVN-> Create
Repository here.

Next, you will see the following window, which mainly asks you whether the Repository database format you want to use is FSFS or BDB. Basically, select FSFS. After you press OK, you can see the next screen.

This
It indicates your SVN
Repository has been successfully created. The next step is to back up your file. In the future, we can use this repository
File: // E:/SVN_REPO indicates it. SVN uses this URL to get in touch with Repository. The URL formats are as follows:

File: // disk drive |/repository directory/subdirectory
Http: // account @ server name/repository directory/subdirectory
Https: // account @ server name/repository directory/subdirectory
Svn + ssh: // account @ server name/repository directory/subdirectory

Http indicates that the common hyper-text communication protocol is used. Https indicates the encrypted hyper-text transmission communication protocol. Svn + ssh Indicates access through the SSH encrypted communication pipeline.


Create a Working directory

The so-called Working directory is actually the place where you normally store work files. Generally, we will wait for a section of our work to back up. So we usually
Work under the Working directory and wait until the appropriate time in commit to repository. For example, we want to create a directory named working under the D-slot. First
Create the directory first.

In this case, the directory should be empty.

Right-click the archive administrator and select SVN (you can press the icon in the working directory or enter the working directory and press it in a blank place ).
Checkout.

Then you can see the following picture:

First, we need to fill in the repository location. For SVN, the repository location is a URL. Because we have already created a repository in the E-slot, we need
For repository, enter file: // E:/svn_repo /.

Next, let's take a look at the checkout directory. This field should point to your working directory. Click OK to see the following message window.

This indicates that the action is completed. Click OK and go to the directory you just created. You will see a directory named. SVN under the working directory (this directory is hidden. If your file Administrator does not set it, you will not be able to see the hidden directory)
.

SVN creates the. SVN subdirectory under your working directory and Its subdirectory. You should not go into this directory, especially do not change any content under this directory. Otherwise, SVN may not work properly.

Because the original repository is empty, our current working directory is also empty. If you are currently checkout a repository with existing content, you will see that there are many more directories and files under the working directory.

If you want to checkout the file on an existing SVN server, you only need to specify the correct URL and the name of the working directory. You can obtain the specified file and directory.


Add files and directories to Repository

Assume that all the preceding actions are correct. Now you start to develop a new program. Assume that the program you developed will be placed under the my _
Prj subdirectory. As follows:

Assume that you have edited the files and want to put them in SVN repository. Right-click the icon in the my_prj directory and choose tortoisesvn-> Add:

Tortoisesvn will display the files and directories to be added. To be added to repository. If you do not want to add files or directories to this project, do not select this project. In this way, it will not be added to repository.

After you press OK, you will see the following message window:

This indicates that the operation is successful. Note that the Add action does not actually put the file in Repository. Only tell SVN to prepare to put these files in Repository. At this time, if you view these files through the archive administrator, you will see a white exclamation point under the archive icon.

This indicates that the files in your working directory are not synchronized with those in Repository. Now we need to add one more commit action. Put these files
In Repository. You can right-click the icon in the my_prj directory or the blank space in the my_prj directory to open the following menu and select SVN
Commit.

Then, you will see the following window:

In this window, a list will be listed in the lower half to give you a clear picture of the files to be committed to repository. Similarly, if you have an archive that you do not want to commit to Repository at this time, you can cancel the selected archive so that they will not be commit to Repository.

At the top of the archive list is the Message column, where you can enter the purpose of this commit. This is a very important field. When you commit a large number of times, you can rely on this message to know
Differences between versions. After you enter the Message and press OK, the following window appears, notifying you that the specified file has been sent to Repository.

You can go to the previous folder to check whether all the file icons have the following green hooks. This means that your files are correctly recorded in repository.

Sometimes, due to Windows problems, you may see that some icons do not turn green. Press F5 several times to solve the problem. If it still does not work, it indicates that your previous commit action is actually faulty. Check whether the previous commit action is correct.


Update files and directories

Why update? Most version control systems are used by many people. Therefore, some people may edit the same file. To ensure that the files in your working directory are synchronized with those in repository. We recommend that you perform the update operation before editing. Here, we assume that you have checked the file
Once. Now we need to explain how to update a check-out directory. Right-click the file or directory icon you want to update. Select SVN
Update.

Normally, you can see the window above. In this window, the files updated are displayed. If you do not see the file update information, it indicates that the file in your directory is up-to-date, so you do not need to update it.


Update to a specific version

Sometimes we need to trace back to a specific date or version, then we can use the svn update to revision function. Right-click the file or directory icon you want to update. Select tortoisesvn-> Update
To revision.

In this update window, you can choose to Update to the latest version (head ). You can also choose to update to a specified version (revision ). Of course, you may not remember the correct version number. You may only vaguely remember the approximate time. It doesn't matter. Press show
Log button to review the history.

All the actions you have done, and their dates and corresponding versions are listed in this window. Just click on the version you want to change it to a whitelist, and then press OK. This version is automatically filled in the revision field in the update window. If you press OK again, this version will be taken out to your hard disk.


Copy files and directories

Most of the time you want to have another copied directory for new compilation. After confirming that the Branch has been modified, merge it to the original major development version. For example, we are currently working
Copy contains the following directories and files:

Now, we need to create a branch for the trunk directory. Suppose we want this directory to be in D:/working/my_prj/Branch
/My_new_branch_for_testing. First, we can right-click the blank space under the trunk directory or directly under the trunk icon.

Select Branch/Tag... After this project, you will see the following dialog box.

Make sure that the directory in From WC at URL is the source directory to be copied. Then, enter the path you want To copy To URL. Generally, we will put all branch in a directory. In the preceding example, branch files are stored in the sub-directories of branch. In
You only need to enter the directory you want in the URL. If the directory does not exist, SVN will help you create it. Note that SVN uses a slash as a directory separator rather than a backslash.

Enter the purpose of your branch in Log message. Press OK.

If it succeeds, you can see the following picture:

Press
Click OK to close the window. If you go to working now
Under the branch subdirectory of copy, you will be disappointed to find that there is no specified directory under this directory. This is because you work
The copy part is still old. You only need to perform SVN under the branch subdirectory
Update to see the new directory. The new directory has nothing to do with the original directory. You can edit it at will until you confirm all the work you should do under branch.
After that, you can choose to return this branch merge back to the original trunk directory, or keep it in branch.

The method for returning merge to the trunk directory is simple. In the preceding example, right-click the D:/working/my_prj/trunk directory and select Merge:

The following figure is displayed:

This
Pictures are divided into three parts: From: and:
It is to ask which version of branch you plan to go back to the original trunk directory. Therefore, the from and to URL fields must specify the original
Branch directory. The rest is to specify the revision range for merge. In the preceding example, we use Branch's revision
7. Start merge to the latest version under branch. You can use, dry
Run button. Try merge once. This merge will only display some messages and will not be actually updated to the trunk directory. Only by pressing the merge button will
Branch files are merged with trunk files.

The above message tells us that YYYY. cpp and xxx1.cpp under the trunk Directory have been changed. If you go to the trunk directory, you will see the two files in the modified state.

If you confirm that there is no problem with this merge, you can directly use commit to commit the two modified files back to SVN.
Repository. If there is a problem, you can directly modify the two files until the confirmation is OK, and then commit.

If everything goes well, you will successfully return Branch's file merge to trunk.


Create a Tag or Release

The so-called tag or release is a special version, because this version may be of special significance. For example, this version is especially milestone or release for customers.
. In fact, the tag and release practices are exactly the same as branch. Only branch may need merge back to the original trunk, while the tag and
Most of release does not require merge to return to trunk. For example, today we have a trunk version, which is regarded as version 1.0 of the software. Version 1.0 for development
It is a very important milestone. So we need to make a tag for him. Assume that
Version 1.0 is intended to be officially release to the customer or the relevant vendor, and we want to make a Release Mark for it. Basically, SVN only has the concept of directory, and there is nothing
Tag usage. So you will see that on the SVN menu, Branch and Tag are the same project. In the example of 1.0, right-click the Trunk,
Select the Branch/Tag project:

If the Tag is successfully created, a 1.0 directory is created under the Tag directory. Of course, if you go to the directory under the Tag, you will not see this directory. You need to update it under the Tag directory to see it.

The procedure for making a Release is exactly the same as that for creating a Tag. Just replace the directory of the Tag with Release.

View
At this point, I believe everyone has realized that either Branch, Tag or Release only copies the specified Trunk version to another directory. This directory is called
Branch is still called Release, and SVN doesn't care. Therefore, you can use another directory name. However, Branch, Tag, and Release are already agreed on by SVN.
A common name. Therefore, unless you know why you did this, it is best to follow the naming principle of follow, so that new users will not understand it.

NOTE: In the same way, Trunk is just a convention name. It does not have to be called Trunk. The Trunk directory shows the main development Trunk.

Quick Reference

I wrote a lot of nonsense, mainly for those who have no idea about version control. If you want to know how to use a function, see the following section.

In the subsequent instructions, d:/working is used as the working directory. You can replace it with any other directory you want.


Get (Checkout) Repository

  1. Open the archive administrator and enter d:
  2. Right-click the archive administrator blank space and select SVN Checkout
  3. In the Checkout dialog box,
    1. URL of repository: the location of the repository.
    2. Checkout directory: the location where working copy is to be stored.
  4. If the d:/working directory does not exist, SVN will ask you if you want to create this directory. Select Yes.
  5. Then press OK to checkout the directory.


Update a file or directory

  1. Right-click the file or directory icon that you want to update from repository to working copy. Select SVN
    Update.
  2. If you want to Update to a specific version, select TortoiseSVN-> Update to revision. In the Update dialog box, enter the version you want in the Revision field. You can also use Show
    Log button to view version information.

Add a file or directory

  1. Right-click the icon of the file or directory that does not belong to repository. Select TortoiseSVN-> Add.
  2. Select the file to be added.
  3. Press OK.

NOTE: Newly Added files must be submitted (Commit) before they can be truly put into Repository.

Submitted (Commit) modified files or directories

  1. Right-click the modified file or the blank space of the entire directory.
  2. Select the files or directories to be submitted to Repository.
  3. Enter the Message ). This message should be clear but should not be too simple. To facilitate future version tracking.
  4. Press OK.


Copy/Tag/Branch/Release file or directory

  1. Make sure that the file or directory you want to process is the latest version in Repository.
  2. Right-click the directory or file to be processed and choose TortoiseSVN-> Branch/Tag.
  3. Enter the destination at the To URL.
    1. Branch: generates a branch. To differentiate development from trunk.
    2. Tag: to form a tag that represents an important milestone.
    3. Release: indicates a record of a formal release.
    4. Others: perform a copy operation ).

 

 

________________________________________________________________________

 

Full text

 

URL: http://www.uml.org.cn/pzgl/200904246.asp#1

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: info-contact@alibabacloud.com 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.