First, get information from the version library
SVN help command
Get Child Command Description
SVN info $URL
View workspace Information
If the directory address, view the local directory information, if no $dir, default to the current directory
If file address, view local file information
SVN list
Displays files in a given directory that exist in a version
Svnlist displays a list of SVN record files in the current directory and does not access the version library
SVN list $URL not download files to the local view directory
Check history:
SVN log
View historical modification information, showing author and date information for each version attached to the version and all path modifications
SVN log 5:19 View historical information for version 5 to 19
SVN Log View history modification information for the current directory
SVN log filename View historical modification information for a single file
SVN log $URL View historical information for $url
SVN diff
Review the changes that show the details of each file change
SVN diff Compare changes to local working copy
SVN diff-r 3 filename Compare local working copy with version library specified version
SVN diff-r 2:3 $URL Two versions of the Compare version library
Local (working copy) and local modified version comparison, to accurately view the modified content, delete the previous line-, add a line before A +
SVN cat
Print a specific version of a file on the screen
SVN cat-r 2 filename display file specified version content
SVN st [parameter] "St=status"
Perform a check
"Unlike SVN diff, the SVN St only shows file modifications, not details"
SVN St $DIR view locally made changes
Before you do svn revert/ci, do this to avoid misoperation
Output hint: M A D R? C
Modify add remove jacquard not included version control conflict file older than version library version
Parameters |
Example |
Significance |
Do you want to contact the version library |
Path |
SVN status |
View all directory file information under current directory |
No, compare to the local modification before |
|
SVN status Aa/a.txt |
View file information in a specified directory |
|
-V |
SVN status-v |
All directory file information under current directory, even if not changed |
Ditto |
-U |
SVN status-u |
Compared to the latest version of the library, * hint files need to be updated |
Yes, compared to the latest version of the version library |
two, from the version library to the 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, each directory contains one. SVN admin directory
$URL and $dir siblings
If the local directory address is not added, the remote folder is copied to the current directory by default
SVN export $URL $DIR "usually used at the time of packing"
Export a clean directory tree from the version library, with SVN co but without. SVN directory
Non-working copy
SVN up "Up=update"
Update your local workspace and keep up with the SVN server
Update your work copy to get this change to the time of others
Output hint: U A D R G C
Update Add Delete replace merge conflict
SVN up updates the local workspace by default to update all files under the current directory and its subdirectories to the latest version
SVN up filename update filename is up to date
SVN up–r file.c–m "Update the version to 200" restores the local file.c to version 200 and submits it to the server "Local is taken down, the version library has not been changed"
Iii. from local to version libraries
SVN import $DIR $URL-m annotation information "Generate Commit action"
Import the directory under $dir into $url without creating a new directory under $url
That is, the content under Dir is copied 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 version Library Test folder
At this time, the local dir unchanged, local and server is not established management, need to perform checkout to remove the server content to actually create a working copy locally
Equivalent to copy from local to version library, source file is not related to version library file
To create a new directory SVN import $DIR $URL/$DIR
SVN add File "local operations"
Add a file or directory locally to the SVN ci before submitting
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 deletes the test directory and test.c to execute SVN ci when submitted, version added "Once Svndel, local folders or files are deleted"
SVN del $URL –m "del the Dir for some reason" produces submit, version added
SVN mv $URL/old $URL/new-m "annotation" "mv=move equivalent to svn cp after SVN delete"
Files/directories that move or copy workspace or version libraries can also be used for file renaming
SVN mv foo.cf.c workspace file name, using SVN ci to generate submit
SVN mv–m "Move a file" $URL 1 $URL 2 moving files, generating submissions
SVN rm $URL/dir-m "Notes"
Directory deletion
SVN ci-m "Annotation info" "Ci=commit"
Submit additions and deletions and change operations
Note that after submitting, the local SVN list is still old and requires manual svn up to get the latest
svn revert filename "local operation, will be lost modified, cautious use"
Restores changes to a file or directory to undo a local modification before the commit operation (CI) is performed.
Equivalent to performing SVN rm filename,svn up-r BASE filename
SVN revert–r $DIR Restore all changes in the workspace $dir directory
svn revert test.c Restore test.c modifications
SVN mkdir $URL/dir-m "notes"
Workspace or version library creation directory
SVN mkdirnewdir A new directory newdir the local workspace, generating submissions via SVN ci
SVN mkdir–m "Making a dir" $URL/$NEW Generate Submit _dir
SVN cp $URL 1 $URL 2-m "notes"
Mutual copies of files between working copies or versions of libraries
Origin (SRC) and destination (DST) can be a working copy path or address (URL):
Working copy-> working copy: copying and adding via scheduling (contains history)
Work copy-> address (URL): Immediately submit a work copy to address (URL)
Address (URL)-> working copy: Check out address (URL) to working directory, through scheduling into
Row increase
Address (URL)-> address (URL): Full server-side replication; general for branches and labels
SVN cp foo.txtbar.txt Local file copy
SVN cp $URL $dir Local new $url directory, $url directory will be placed under $dir
SVN cp $URL 1$url2–m "Note" to produce a submit operation
SVN cp $DIR $url–m "Note" to produce a submit operation
can also be used to create a new branch
After SVN co$url2, you can do it in a branch working copy, svn ci-m "fix bug 1031"
Retrieve the deleted item
None in current version, previous version exists
-Exact copy svn cp-r19 $URL/filename filename
-Check Results Svnstatus
-Submit SVN ci-m "resurrected C.txt fromr19"
Four, advanced application:
SVN merge–r m:n Path
Compare two version trees, apply differences to local copy initial version tree final version tree a work copy to receive 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
-Make the working directory a local copy of the backbone
$CD Proj/trunk
$SVN up
You can see the latest version, assuming R15
-Perform merge
$SVN merge-r 10:15 $URL
-Check the results of the merge, perhaps to manually resolve the conflict, and finally submit
$SVN ci-m "merged br_1_0 10:15 to Trunk"
Code rollback
Undo a submitted version, modify incorrectly, should not be submitted, need to roll back to previous version
-Execute command
$SVN merge-r 20:19 $URL
-Check work Copy results
$SVN status
-Submit Copy Results
$SVN ci-m "undo change commited in R20"
SVN switch $URL
Provides a shortcut for changing a working copy
such as the original copy on the trunk, currently want to switch to the branch to work
$SVN Switch $ branch URL
Run SVN info |grep URL to see the URL of the file sign is the path of the branch
SVN resolved filename