Using SVN under Linux

Source: Internet
Author: User
Tags diff svn update

Installation: Apt-get Install Subversion

CHECKOUT CHECKOUT files to a local directory

SVN checkout Path (path is a directory on the server)
Example: SVN checkout Svn://192.168.1.1/pro/domain
Shorthand: SVN Co


Add new file to Repository
SVN Add File
Example: SVN add test.php (add test.php)
SVN add *.php (Add all php files in the current directory)


Commit commits the modified file to the repository
SVN commit-m "LogMessage" [-n] [--no-unlock] PATH (use –no-unlock switch if hold lock is selected)
Example: SVN commit-m "Add test file for my test" test.php
Shorthand: svn ci


Lock/unloch Locking/unlock
SVN lock-m "Lockmessage" [--force] PATH
Example: SVN lock-m "lock test File" test.php
SVN unlock PATH


Update updates to a version
SVN update-r m path
For example:
SVN update If there is no directory behind it, the default is to update all files in the current directory and subdirectories to the latest version.
SVN update-r test.php (Restore the file test.php in the repository to version 200)
SVN update test.php (updated, sync in Repository.) If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit)
Shorthand: SVN up


Status View file or directory state
1) SVN status path (status of files and subdirectories under directory, normal status not shown)
"?: not in SVN control; m: content has been modified; C: conflict; A: Scheduled to be added to the repository; K: Locked" M state is generally more
2) SVN status-v path (show file and subdirectory status)
The first column remains the same, the second column shows the work version number, and the third and fourth columns show the last modified version number and the modified person.
Note: The SVN status, SVN diff, and SVN revert three commands can be executed without a network, because SVN retains the original copy of the local version in. svn.
Shorthand: SVN St


Delete deleting files
SVN delete path-m "Delete test Fle"
Example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete test file"
Or go directly to svn delete test.php and then svn ci-m ' delete test file ', which we recommend using this
Shorthand: SVN (del, remove, RM)


Log View Logs
SVN log path
For example: SVN log test.php shows all changes to this file, and its version number


Info view file details, look at the original SVN address
SVN info [path]
Example: SVN info test.php


diff Comparison differences
SVN diff path (compares the modified file to the base version)
Example: SVN diff test.php
SVN diff-r m:n Path (difference between version m and version N)
Example: SVN diff-r 200:201 test.php
Shorthand: SVN di


Merge merges the differences between the two versions into the current file
SVN merge-r m:n Path
For example: SVN merge-r 200:205 test.php (the difference between version 200 and 205 is merged into the current file, but generally conflicts occur and need to be addressed)

Some tricks

How to switch users

Temporary switchover: Force the--username and--password options under commands, for example: svn up--username Zhangsan--password 123456

Permanent switchover: Deletes all files under directory ~/.subversion/auth/. The next time you operate SVN, you will be prompted to re-enter your username and password. You can use it for what you want. The system is then logged by default.

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.