TortoiseSVN Usage Tutorial
TortoiseSVN is a free open-source client for the Subversion version control system, which manages files and directories over time.
TortoiseSVN Installation
Download link: https://tortoisesvn.net/downloads.html, the page includes links for language pack patches.
The latest version currently is 1.11.0, download link: https://osdn.net/projects/tortoisesvn/storage/1.11.0/
In the language patch package, we can find the Chinese patch and download it:
Run the downloaded TortoiseSVN installer.
Run the downloaded TortoiseSVN Chinese language pack.
After a correct installation, a reboot should be done to ensure TortoiseSVN functions correctly.
Modify TortoiseSVN Default Language
After installing TortoiseSVN, the default interface is in English. We can change it to the installed language through settings.
Using TortoiseSVN
Create a Working Directory named tutorialpro01
The tutorialpro01 directory is essentially where you store your work files. Usually, we back up our work when it reaches a certain stage. So, we usually work under the tutorialpro01 directory and commit to the repository at the appropriate time. For example, we want to create a directory named tutorialpro01 under the D drive. First, create this directory.
Enter the created directory and right-click in the空白处 (you can right-click on the MyWork directory icon or inside the MyWork directory), then select SVN checkout
.
Next, you will see the following screen:
First, we need to fill in the repository location, which for SVN is a URL. Enter the repository URL for our test repository: svn://10.0.4.17/tutorialpro01.
Then, check the Checkout directory field, which should point to your tutorialpro01 directory.
After confirming, press the OK button, and you should see an information window indicating the action is complete.
Press OK, and then go to the directory you just created. You will see a new directory named .svn
under MyWork (this directory is hidden, and you won't see it if your file manager is not set to show hidden directories).
If you want to checkout files from an existing SVN server, you just need to provide the correct SVN URL and the name of the directory to checkout.
Adding Files and Directories to the Repository: Add and Commit
Create a directory named dir01 and add files inside it.
Add the new files to SVN version control. TortoiseSVN will select the files and directories to be added.
Press OK, and you will see a message window indicating the Add action is complete. This action only informs SVN that these files are to be added to the repository.
Right-click in the空白处 and select SVN commit to actually add these files to the repository. You will then see a window where you can see which files are to be committed. You can deselect files you do not want to commit at this time. Enter a message in the "Information" text box to describe this commit.
Click "Confirm" to complete the commit action. Then, check the tutorialpro directory to ensure all file icons have a green checkmark, indicating the files are correctly in the repository.
Updating Files and Directories: Update
Since version control systems are usually used by many people, the same files may be edited by others. To ensure your working directory files are in sync with the repository, it is recommended to update before editing.
Right-click on the file or directory icon you want to update and select SVN Update. Sometimes we need to go back to a specific date or version, and this is where the SVN Update to revision feature comes in handy. Right-click on the file or directory icon you want to update and select TortoiseSVN -> Update to revision.
Copying Files and Directories - Branch
Often, you may want to have a duplicate directory to make new edits. Once you're sure the changes in this branch are complete, you can merge them back into the main development version. For example, we currently have the following directories and files under tutorialpro01/trunk:
Now, we want to create a branch for the trunk directory. Let's say we want this directory to be at D:\tutorialpro01\branch. First, right-click in the empty space within the trunk directory or directly on the trunk icon, and select Branch/Tag…. You will see a dialog box like this:
Make sure the directory in From WC at URL is the source directory you want to copy from. Then, enter the destination path in To URL. Usually, we keep all branches under one directory. In this example, branch files will be under the branch subdirectory. You only need to enter the desired directory in To URL; if it doesn't exist, SVN will create it for you. Note that SVN uses forward slashes as directory separators, not backslashes. Next, enter the purpose of this branch in the Log message. Press OK to proceed.
If successful, you will see the following screen:
Press OK to close this window. If you go to the branch subdirectory under the tutorialpro01 directory right away, you might be disappointed to find that the specified directory does not exist. This is because your tutorialpro01 directory is still outdated. You just need to perform an SVN update in the branch subdirectory to see the newly added directory. The new directory is independent of the original one. You can edit it freely until you're sure all work in the branch is complete. You can then choose to merge this branch back into the trunk directory or keep it in the branch.
Merge Action
If we made changes or added files in the branch and want to merge them back into the trunk directory, the process is straightforward. In our example, right-click in the empty space in the D:\tutorialpro01\trunk directory and select Merge:
This screen is mainly divided into three parts: From and To ask which versions from the Branch you want to merge back into the trunk directory. Therefore, the URLs in From and To should specify the original branch directory. The rest is to specify the range of revisions to merge. In our example, we start merging from Branch Revision 7 to the latest version in the Branch. You can use the Try run button to simulate a merge. This merge will only display messages and will not update the trunk directory. Only after pressing the Merge button will the files from the branch be merged with those in the trunk.
If you confirm that this merge is correct, you can directly use commit to commit the modified files back to the SVN repository. If there are issues, you can modify the files until they are okay, and then commit.
Creating a Tag or Release
A Tag or Release is a special version because it may have special significance. For example, this version could be a significant milestone or a release for clients. The process for creating a Tag or Release is identical to that of a Branch. However, branches may need to be merged back into the trunk, while tags and releases usually do not.
For example, today we made a version of the trunk that is considered the 1.0 version of the software. Version 1.0 is a significant milestone for development. Therefore, we need to specifically mark it, known as a Tag. Suppose this Version 1.0 is to be officially released to clients or relevant vendors; we need to create a Release tag for it. Essentially, SVN only has the concept of directories and does not use Tags. Thus, you will see in the SVN menu that Branch and Tag are the same item. For this example of Version 1.0, we create a tags directory under the tutorialpro01 directory to store the tagged versions, commit it to the repository, and then, on the Trunk, right-click and select the Branch/Tag item:
If successful, you will have created a v1.0 directory under the corresponding Tag directory. However, if you go to the Tag directory now, you won't see this directory; you need to update the Tag directory to see it.