SVN instructions and Common commands

Source: Internet
Author: User

Note: Configure Svn in window

1. Create a file in the network root directory (right-click Create repository here)

2. Command method: svnserve -- daemon -- root E: \ svnroot | svnserve-D-Re: \ svnroot

3. Create svnstart. bat with the following content:

SC create svnserve binpath = "E: \ ProgramFiles \ tortoisesvn \ bin \ svnserve.exe -- service-R D: \ svnroot" depend = tcpipstart = auto

SC start svnserve

Pause

SVN: // server IP address. The file list under svnroot is accessed by default.

Svnserve-d-r "E:/svnroot" specifies the svnsvn root directory path

 

4. After the resource library is created, import the system resource Doc. SRC supports AddFile, delete, and commit (new version)

5. If other users need to share file resources, checkout specifies the local file path to the version. Update each update to solve conflict and commit.

6. Summary of common SVN commands:

6.1 create a version library svnadmin create file_path/repo_name

6.2 start the server svnserve.exe-D-rfile_path-D to run the root directory of the-R version library in the background

6.3 URL for accessing this version Library: SVN // localhost/repo_name

6.4 initial client Import

SVN import-M "init import" http: // 10.0.0.6/SVN/teaching/

6.5 checkout:

SVN cohttp: // hibernate3demo.googlecode.com/svn/tags/helloworld_r1

Or: SVN checkouthttp: // hibernate3demo.googlecode.com/svn/tags/helloworld_r1

Download the latest version of the svn server to a local copy.

6.6 update)

Command Line: SVN update or SVN up

Update the local work copy with the latest version of the svn server.

When many people work together, updates should be updated frequently, and problems should be exposed as early as possible to facilitate handling.

Update the code before submitting the code. Otherwise, a version conflict may occur.

6.7 Add (ADD) SVN add file_path

Tell the svn server to add directories and/or files to the server, but the operation is not performed until commit.

6.8 submit changes

It is equivalent to a general concept: checkin ). Command Line: SVN commit or: SVN Ci

Submit all modifications to the local work copy, which are atomic. Requirement: Generally, the reason for the modification must be specified.

SVN ci-M "Modify bug #224"

Requirement: Update SVN up SVN ci-M "Modify bug #224" before submission"

6.9 restore changes

The corresponding commit operation must have a rollback operation. SVN revert

This operation is very useful to developers and can be "restored with one click" After many code changes ".

6.10 "Restore" submitted changes

Revert is only applicable when not submitted.

If a problem is found, roll back to the previous revision.

First, you need to: SVN up to update the local work copy to the latest state.

Then: SVN log your_file_path

View the file log. The description entered during submission will be used in this case.

View the differences between the two revisions:

SVN diff-r old version number: New Version Number your_file_path

After deciding which old version number to use, overwrite the new version number file with the old version number file.

SVN merge-r new Revision No.: Old Revision No. your_file_path

You also need to: SVN commit-M "Restore to a certain version (a certain version is invalid )"

This restoration is called. Instead of replacing the old version number, it overwrites the new file.

6.11 copy files and directories

SVN copy path/file_name newpath/new_file_name

SVN commit-M "XXXX"

Or:

Svn cp path/file_name newpath/new_file_name

SVN commit-M "XXXX"

SVN copy is an important tool. It is used to implement versions, branches, labels, and other concepts.

SVN copy is a cheap copy.

6.12 rename a directory/File

SVN move file_name new_file_name or: svn mv file_namenew_file_name

6.13 deal with merge conflicts

SVN does not lock files by default.

If different users edit different parts of the same file, the file is automatically merged upon submission.

If different users edit the same part of the same file, the submitter reports a merge conflict.

Solution (manual arbitration): discard changes;

Stick to your changes, find the. Mine file name, restore to the original file name, and then execute:

SVN resolved file_name

6.14 delete an object

Delete a local copy of work.

SVN Delete file_path or: SVN del file_path


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.