Centos SVN client application

Source: Internet
Author: User
Tags svn client svn update

1. Install tortoisesvn on centos

Yum install-y Subversion

 

Ii. SVN client commands

1. Checkout the file to the local directory.SVN checkout path (path is the directory on the server)

Example: SVN checkout SVN: // 192.168.1.1/Pro/Domain

Abbreviation: SVN Co

2. Add new files to the version LibrarySVN add File

Example: SVN add test. php (add test. php)

SVN add *. php (add all PHP files in the current directory)

3. Submit the modified file to the version library.SVN commit-M "logmessage" [-N] [-- no-unlock] path (if you choose to keep the lock, use the-no-Unlock switch)

For example: SVN commit-M "add Test file for my test" test. php

Abbreviation: SVN Ci

4. Lock/unlockSVN lock-M "lockmessage" [-- force] path

For example, SVN lock-m "lock test file" test. php

SVN unlock path

5. Update to a specific version.SVN update-r m path

For example:

If there is no directory after SVN update, all files in the current directory and sub-directories are updated to the latest version by default.

SVN Update-R 200 test. php (restore the file test. php In the version library to version 200)

SVN updatetest. php (updated for version library synchronization. If the message "expired" is prompted during submission, it is because of a conflict. You need to update the file, modify the file, clear svnresolved, and then submit commit)

Abbreviation: SVN up

6. view the file or directory status1) SVN status path (the State of the files and subdirectories under the directory. The normal state is not displayed)

【? : Not under SVN control; M: The content is modified; C: A conflict occurs; A: It is scheduled to be added to the version Library; K: it is locked]

2) SVN status-V path (displays the status of files and subdirectories)

The first column remains the same, the second column displays the working version number, and the third and fourth columns show the last modified version number and modifier.

Note: SVN status, SVN diff, and svnrevert commands can also be executed without a network, because SVN retains the original copy of the local version in local. SVN.

Abbreviation: SVN St

7. delete an objectSVN Delete path-M "delete test FLE"

For example, SVN delete SVN: // 192.168.1.1/Pro/domain/test. php-m "Delete testfile"

Or directly delete SVN test. php and then SVN ci-M 'delete testfile'. We recommend that you use this

Abbreviation: SVN (Del, remove, RM)

8. View logsSVN Log Path

For example, SVN Log Test. php displays all the modification records of this file and changes to its version number.

 9. View File details

SVN info path

Example: SVN info test. php

 10. Differences

SVN diff path (compare the modified file with the basic version)

Example: SVN diff test. php

SVN diff-r m: N path (differences between version m and version n)

Example: SVN diff-r 200:201 test. php

Abbreviation: SVN di

11. Merge the differences between the two versions into the current file.SVN merge-r m: N path

Example: SVN merge-R 200: 205test. php)

 12. SVN help

SVN help

SVN help Ci

------------------------ The above are commonly used commands. Below I will write a few commonly used commands -------------------------- 13. List of files and directories in the version LibrarySVN list path

Displays all files and directories in the path directory that belong to the version library.

Abbreviation: SVN ls

14. Create a new directory under Version ControlSVN mkdir: Create a new directory under version control.

Usage: 1. mkdir path...

2. mkdir URL...

Create a version control directory.

1. Each directory specified by the working copy path will be created on the local end and added to the new

Scheduling to wait for the next submission.

2. Each directory specified with a URL is created by submitting it to the repository immediately.

In both cases, all the intermediate directories must exist in advance.

 15. Restore local modification

SVN revert: restore the original unchanged working copy file (recover most local modifications ). Revert:

Usage: Revert path...

Note: The sub-commands do not access the network and will release the conflict. However, it does not restore the deleted directory.

 16. code library URL change

SVN switch (SW): update the working copy to different URLs.

Usage: 1. Switch URL [path]

2. Switch-relocate from to [path...]

1. Update your work copy and map it to a new URL. The behavior is similar to "SVN Update" and

Merge files on the server with local files. This maps the work copy to a branch or tag in the same warehouse.

Method.

2. Rewrite the URL metadata of the working copy to reflect the changes on the simple URL. When the root URL of the Repository changes

(For example, the solution name or host name change), but the working copy is still mapped to the same directory in the same repository.

This command updates the correspondence between the working copy and the warehouse.

 17. Conflict Resolution

SVN resolved: the "Conflict" Status of directories or files that remove working copies.

Usage: resolved path...

Note: subcommands do not follow the syntax to resolve conflicts or remove conflicting tags. They only remove conflicting tags.

Related files, and then allow the path to be submitted again.

 18. output the content of the specified file or URL.

SVN cat target [@ version]… If a version is specified, search for it from the specified version.

SVN cat-r Prev FILENAME> filename (prev is the previous version, you can also write a specific version number, so that the output result can be submitted)

 

Create and initialize a version Library

1. Create a code repository

# Svnadmin create/home/myrepos

In this way, the version library myrepos is created in the/home directory.


2. initialize the code repository

# Mkdir-P code/{branches, tags, trunk}

According to the suggestions in the svn manual, the layout of our version library uses three directories such as branches, tags, and trunk. Then you can copy the Code directly to the trunk directory, or add it in svnadd mode.

 

# SVN import code file: // home/myrepos

Submit the constructed version library layout (and code, if copied to trunk) to the version library. Because we operate locally, you can directly use the File protocol for submission. Format: file: // + absolute path of the version Library

 

OK. Here we have built a local version library. You can use the svnci method locally to obtain a copy of the version library. If the layout of the version library is submitted but the code is not submitted, run the following command to submit the version code:

# SVN Co file: // home/myrepos/trunk Repos

Generally, the source code is extracted from the trunk directory and stored in the new repos directory. You can then copy the source code to the repos directory.

Run the following two commands to add the version Library to the Code.

# SVN add *

# SVN cI *-M "committed codes"

First, you need to add the copied code to the current copy, and then submit the code to the version library.

Related Article

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.