SVN command line

Source: Internet
Author: User
Tags commit diff file copy mkdir svn versions
I. Getting information from a repository

SVN help command

Gets the description of the subcommand

SVN info $URL

View workspace Information

If the directory address, view the local directory information, if no $dir, the default is that the current directory

If the file address, view local file information

SVN list

Displays files in a given directory that exist in a version

Svnlist Displays the SVN record file list under the current directory without accessing the repository

SVN list $URL not downloaded to local view directory files

Check history:

SVN log

View historical changes to show author and date information and all path modifications for each version attached to the version

SVN log 5:19 View historical information for versions 5 to 19

SVN Log View Historical modification information for the current directory

SVN log filename View history modification information for individual files

SVN log $URL View historical information for the.

SVN diff

Review your changes to show details of each file change

SVN diff Compare changes to local working copy

SVN diff-r 3 filename Compare local working copy with repository specified version

SVN diff-r 2:3 $URL Compare two versions of a repository

Local (working copy) and local modified pre-version comparison, exact view of the modified content, deleted rows before one-, add the line before a +

SVN cat

Print a file-specific version of content on the screen

SVN cat-r 2 filename display file specified version content

SVN st [parameter] "St=status"

Perform checks

"Unlike SVN diff, svn St shows only file modifications, not details"

SVN St $DIR view changes made locally

Do this before you do the SVN revert/ci, so that you don't miss the action

Output hint: M A D R? C

Modified add delete Jacquard not included version control conflict file older than version library version

Parameters

Example

Significance

Whether to contact repository

Path

SVN status

View all directory file information in the current directory

No, compared to local pre-modification

SVN status Aa/a.txt

View file information in the specified directory

-V

SVN status-v

All directory file information in the current directory, even if it has not changed

Ditto

-U

SVN status-u

Compared to the latest version of the repository, * Prompt files need to be updated

Yes, compared to the latest version of the repository

Ii. from repository to local

SVN co $URL $DIR "Co=checkout"

Check out SVN library files to your local workspace

Check out the target file to a local directory, resume a working copy, and each directory contains a. SVN admin directory

$URL and $dir Peers

If you do not add a local directory address, the remote folder will be copied to the current directory by default

SVN export $URL $DIR "typically used when packaging"

Export a clean directory tree from the repository, with SVN co, but without the. SVN directory

Non-working copy

SVN up "Up=update"

Update your local workspace to stay in sync with your SVN server

Update your own working copy to get this to be modified by time others

Output hint: U A D R G C

Update Add Delete replace merge conflict

SVN up updates the local workspace and updates all files in the current directory and its subdirectories to the latest version by default

SVN up filename update filename to latest

SVN up–r file.c–m "Update the version to 200" restores the local file.c to version 200 and commits to the server "Local is taken down, the repository side has not been changed"

third, from local to repository

SVN import $DIR $URL-M "Comment information" "Generate Commit action"

Import the directory under the $dir to the below, without creating a new directory under the

That is, copy the contents under dir to the URL

For example, there is a folder Test/code. Java

SVN import Test $URL/test–m "Import a new file" to copy Code.java to the Repository Test folder

The local dir does not change at this time, the local and the server is not established management, need to execute checkout remove the server content before actually set up a working copy locally

Equivalent to copying from local to Repository, source files are not related to repository files

To create a new directory SVN import $DIR $URL/$DIR

SVN add File "local operation"

Add files or directories to the local, svn CI to commit

SVN add test test.c Add Test directory and test.c file

SVN Delete file

Delete a directory from a local job or URL, or remove a file

SVN del test test.c local workspace Delete Test directory and test.c, commit when SVN ci is executed, version added "Once Svndel, local folder or file is deleted"

SVN del $URL –m "del the Dir for some reason" generates commits, version added

SVN mv $URL/old $URL/new-m "comment" "mv=move equivalent to svn cp after SVN delete"

Files/directories that move or copy workspaces or repositories can also be used for file renaming

SVN MV foo.cf.c workspace file renamed, using SVN ci to generate the commit

SVN mv–m "Move a file" $URL 1 $URL 2 moving files, generating commits

SVN rm $URL/dir-m "Notes"

Directory deletion

SVN ci-m "Annotation Information" "Ci=commit"

Submit additions and deletions and change operations

Note that after submission, the local SVN list is still old and requires manual svn up to get the latest

svn revert filename "local operation, will be lost modification, use with caution"

Restores the modification of a file or directory before the commit operation (CI) is executed, undoing the local modification.

Equivalent to executing SVN rm filename,svn up-r BASE filename

SVN revert–r $DIR recover all changes in Workspace $dir directory

svn revert test.c Recovery test.c modification

SVN mkdir $URL/dir-m "notes"

Workspace or Repository creation directory

SVN mkdirnewdir local Workspace new directory Newdir, generated via SVN ci after submission

SVN mkdir–m "Making a dir" $URL/$NEW _dir generation Submission

SVN cp $URL 1 $URL 2-m "notes"

Copies of files between working copies or repositories

The origin (SRC) and destination (DST) can be the working copy path or address (URL):

Work copy, working copy: Copy and increase by schedule (including history)

Work copy, address (URL): Submit a working Copy to address (URL) now

Address (URL), working copy: check-out address (URL) to the working directory, by dispatching into the

Row increase

Address (URL), address (URL): Full server-side replication; typically used for branching and labeling

SVN cp foo.txtbar.txt Local file copy

SVN cp $URL $dir Local new directory, will put the $dir directory under the

SVN cp $URL 1$url2–m "comment" generates a commit action

SVN cp $DIR $url–m "comment" generates a commit action

can also be used to create a new branch

After SVN co$url2, it can be manipulated in the branch working copy, svn ci-m "fix bug 1031"

Retrieve Deleted Items

None in the current version, existing in previous version

-Exact copy of SVN cp-r19 $URL/filename filename

-Check Results Svnstatus

-Submit SVN ci-m "resurrected C.txt fromr19"

Iv. Advanced Applications:

SVN merge–r m:n Path

Compare two version trees, apply differences to local copy initial version tree final version tree a working copy that receives the difference

Merging branches

-Find the version produced by the branch

SVN log-v--stop-on-copy $URL found that the version produced by the branch is R10

-Local copy of the working directory as the backbone

$CD Proj/trunk

$SVN up

You can see the latest version, assuming R15

-Perform merge

$SVN merge-r 10:15 $URL

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.