SVN common commands

Source: Internet
Author: User
Tags svn update tortoisesvn

First, version library browse Repo-browser
After the installation, click the right mouse button will appear, this is the basic function of SVN, described below.

When you click Repo-browser, the following Small dialog box appears:

Enter the repository you want to connect to:

The input method is: https://server IP: Port number/repository name, such as PQA's configuration library is: Https://10.0.5.8:8443/PQA (remember that SVN is lowercase), click "OK" to enter the login screen. If you have previously logged in, SVN will automatically record your login history. The login interface is as follows:

Enter your user name and password to access your repository.

Second, the basic operation of the repository
1.Add file (folder) add files (folders)
Use this command to add a local file or folder to the server-side directory.

2.commit Submission
The add file can be added to the server using the commit command

3.Show Log View Logs
Click this button to display information about all files and directory logs in the current directory. Will jump out of the following dialog box:

4.Export Export
With this command, you can export a clean directory tree by specifying the path, and the so-called "clean" is that the exported file is not controlled by SVN version. The default is to export the current version of the directory content, of course, you can also specify the version you want to export:

Select the local path in export directory.

5.Revision Graph version Tree display
It can display all the operations done on this directory in the form of graphs, and can record what is done at each step, equivalent to a plot of "Show log", as shown in:

6.Check out Checkout
With this command you can export the selected directory from the server to the local working copy (native), which differs from export in that the checked out file is version controlled as shown in:

7.Refresh Refresh
Refreshes the server-side directory.

8.Delete Delete
The directory or file can be deleted, after the deletion of the version number, you can use "show log" to find the deleted files, and you can see the folder becomes:

Note: The file is deleted only in its own working copy and must be executed for the file to be truly deleted.

9.Rename renaming a directory or file
If you want to rename the file, to the server side of the file or folder with the Rename command, after the change to the local working copy of the parent directory to execute "Commit". You can rename it locally using the Tsvn menu by right-clicking on it.

10.Copy to working copy copies the current directory to a local
The local working copy must be a versioned folder, after executing this command, such as: "01 references" copied to the local working copy of "PQA", will appear, the green checkmark indicates that this directory is from the server "Checkout" out of the version-controlled local working copy, A blue plus sign indicates that the file is pre-added to the server.

At this point, in this directory blank or select the "01 References" folder, right-click the "SVN Commit" command as shown:

"01 References" will be successfully submitted to the "PQA" directory on the server.

11.Copy to copy to
With this command, you can establish a branch (label/baseline) in the current repository, SVN allows parallel maintenance of the branch of the file and directory, links between the branches, and can be copied from one branch to another, eventually allowing the local working copy to be reflected on different branches, so in daily work, you can " Mix and compare "different development lines.

Third, client operation
1. Basic operation of the client
Right-click on the local working copy blank will appear as shown below for a detailed description of the features commonly used in this menu.

Working copy is the execution of "checkout" command from the server side check out to a local directory, is a personal private workspace, in this directory, you can edit any file, if it is a source code file, can be compiled as usual. For example, we make changes to the date of a file in the meeting record in the process record, and the edited file and its top level directory will be displayed as:

You can then perform an SVN commit commit on this file, and the edited content will be submitted to the server so that everyone shares your work.
Right click on the modified version, after the "show log", you can display the version of the log, if you want to see the changes and the original version of the difference, then select the current version of the record, right-click to execute "show changes" as shown:

At this point it will show which actions caused the changes in the version, the red part of the new additions, it is displayed in the form of annotations:

Also add that there are three kinds of permissions on SVN: Read, write, and no permissions. If you want to edit your work copy, then you must have permission to read and write in this directory, if you do not have permissions or read permissions on the server side of this directory, then even if the local copy has been modified, can not be submitted to the server, that is, Each person with Read permission can look up the contents of the Repository directory (no permissions can not be viewed), but can only modify their own directory to be given read and write permissions. This protects your working directory from being randomly altered by others.

2. Introduction of common functions
(1). Revert return to the previous level
If you have made changes to the file, but have not yet committed, but the document is marked with a red exclamation mark, and then you find that the error, you want to return the document to the original state, you can perform the revert operation, can make the document back to the original state, because you did not perform the commit operation, The version number of the repository on the server is not incremented at this time.
(2). Update to revision back to version
If you have already performed the commit operation, you can use the update to revision command to select the version you want to return to in the pop-up dialog, then your local working copy will return to the status of your selected version. "Save revision to" can also archive the original version. The point is that your local working copy can be returned to the original version, but the server will only record the last time you commit the version, so the server-side version will not change, if you want to change the server-side document content to the original state, you can use the old version of the file to overwrite the new version of the file, and then submit.
(3). Import Imports
Import is a way to add files to the server in bulk, if you want to add local files or folders under a directory on the server, then in the local directory, in the blank right-click Tortoisrsvn-import, will jump out of the following dialog box:

Click "OK" to import the local files or folders to the server-side selected directory.
(4). SVN Update Updates
Use this command to update your working copy, because everyone has their own working copy, and as you work on the project directory, other people in the project group are also editing and submitting actions, and the repository content changes with each commit of the project personnel, so before each edit operation, Perform the update operation on the local working copy to ensure that the local working copy is consistent with the contents of the server Project repository.
(5). Resolved Conflict resolved

When two people edit a file at the same time, one person commits the conflict when the other commits, and the Conflict dialog box pops up, as shown in:

You can edit the conflicting files that appear and select the documents you want to end up with. This is the "merge" merge operation. Merging features are often used when conflicts occur and when branches are applied. When the merge is complete, the resolved is executed, and the new version is generated.
(6). Switch Toggle
Switch your work copy to another URL (server directory), server-side directory changes, the location of the stored files have changed, then the work of your copy to edit the situation will not be submitted to go, then you need to perform a switch operation, Switch your working copy to the server-side directory and submit again. The switch operation is limited to switching within the repository.
(7). Relocate re-positioning
It has the same function as switch, but it does this by switching between the repository and the repository. When the server address or repository name changes, you can update your working copy with some commands.
(8). Create an app patch
If you do not have permission to modify this file, but under the circumstances, you have to modify the file, then you can create patches with the Create patch, and then send the patch you created to the directory has write permissions to the staff, he executed the Apply patch, The changes you have made will be submitted to the server.

3. Branching and merging
(1). Download the project's initial source from the main branch of the project to the Development branch
Operation Steps:
1). In the trunk directory, create a new project name of ASTX;
2). In the ASTX project, the new two modules are Module1 and Module2, respectively, to create a new file named Test.txt;
3). Select Astx project name, right click to select Branch/tag;
4). Note that from the WC at URL must be the root path of the project ASTX, to URL: here to select the Path branch store, the usual path is: HTTP://LOCALHOST/SVN/ASTX/BRANCHES/ASTX_DEV_TB;
Note: Branches is the branch's storage path, ASTX_DEV_TB is the name of the branch
5). In the branches directory right click on Update, you can see just the ASTX_DEV_TB branch;
(2). Merge the changes of the branch (ASTX_DEV_TB) into the main branch of the project
Operation Steps:
1). Select Project Main Branch Right click TortoiseSVN Select Merge, select reintegrate a branch;
2). Click Next to select the path to the ASTX_DEV_TB branch in the address bar of the URL to merge from: Note that working copy is the path to the main branch of the project;
3). Click Next, select "Working Copy" in the merge depth drop-down box and click Merge to merge the branch changes into the trunk;
4). In the main branch of the project right click on Commit, the whole process is complete!
5). If you want to go back to the previous version, select the main branch of the project right click TortoiseSVN Select Revert, the contents of this merge will be canceled.
(3). Changes to two different branches merged into the main branch of a project
1). Modify different lines of the same file
Operation Steps:
A. Create two different branches based on the main branch of the project: Astx_dev_john,astx_dev_harry (refer to 1.1 for the method of creating the branch);
Note: John and Harry create their own working copies for the same project, and work in parallel.
B.john and Harry modify the different lines of the same file Text.txt, John Save the changes to the repository (for a specific merge step, refer to 1.2), and finally don't forget commit!
C. When Harry commits the changes, the repository hint file Text.txt has changed since his last update, and if John's modified content does not clash with Harry, once all the changes are integrated, you can save the work copy to the Repository, and finally don't forget the commit!
2). Modify the same line of the same file
Operation Steps:
A. Create two different branches based on the main branch of the project: Astx_dev_john,astx_dev_harry;
Note: John and Harry create their own working copies for the same project, and work in parallel.
B.john and Harry modify the same line of the same file Text.txt, John First saves the changes to the repository (for specific merge steps, refer to 1.2);
C. When Harry commits the changes, the repository prompts the file text.txt conflict, then only can manually select a set of changes, and all the changes to integrate together, you can save the work copy to the Repository, remember to commit! after you finish

SVN common commands

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.