svn command usually have help, you can query through the following ways:
$ Svn help
Know the sub-command, but do not know the usage of sub-commands, you can also check:
$ Svn help add
Developers commonly used commands
(1) into the project
$ Cd ~ / Project
$ mkdir-P svntest / {trunk, branches, tags}
$ svn import svntest https://localhost/test/svntest-Message "Start Project"
...
$ RM-RF svntest
We create a new project svntest, in the three sub-projects under the New: trunk, development trunk; branches, development branch; tags, labels the development stage. Then imported into the repository under test, then svntest removed.
(2) export project
$ Svn checkout https://localhost/test/svntest/trunk
Revision number of the prescribed manner every developer must know, here are a few reference examples refer to svn recommendation.
$ Svn diff-Revision PREV: COMMITTED foo.c
# shows the Last Change committed to foo.c
$ Svn log-Revision HEAD
# shows log for the latest Repository commit Message
$ Svn diff-Revision HEAD
# Compares your Working file (with local changes) to the latest Version
# in the Repository
$ Svn diff-Revision BASE: HEAD foo.c
# Compares your "Pristine" foo.c (no local changes) with the
# latest Version in the Repository
$ Svn log-Revision BASE: HEAD
# shows All commit logs since you Last Updated
$ Svn Update-Revision PREV foo.c
# rewinds the Last Change on foo.c
# (foo.c 'S Working Revision is decreased)
$ Svn Checkout-Revision 3
Revision number # specified with
$ Svn Checkout-Revision {2002-02-17}
$ svn {15:30} Checkout-Revision
-Revision $ svn Checkout {15:30:00.200000}
$ svn Checkout-Revision {"2002-02-17 15:30" }
$ svn Checkout-Revision {"2002-02-17 15:30 +0230"}
$ svn Checkout-Revision {2002-02-17T15: 30}
$ svn Checkout-Revision {2002-02-17T15: 30z}
$ svn Checkout-Revision {2002-02-17T15 :30-04: 00}
$ svn 20020217T1530} {Checkout-Revision
-Revision $ svn Checkout 20020217T1530Z} {
$ svn Checkout-Revision-0500} {20020217T1530
(3) daily instruction
$ Svn update
$ Svn add foo.file
$ svn add foo1.dir
$ svn add non-recursive foo2.dir-
DELETE README $ svn
$ svn Copy foo bar
$ svn move foo1 bar1
$ Svn status
$ svn status-verbose
$ svn status-verbose-Show-Updates
$ svn status Stuff / fox.c
$ Svn diff
$ svn diff> patchfile
$ Svn revert README
$ svn revert
Modify the conflict, it will generate three files:. Mine,. ROLDREV,. RNEWREV. For example:
$ Ls-L
sandwich.txt
sandwich.txt.mine
sandwich.txt.r1
sandwich.txt.r2
One way to solve modify conflicts: modified file conflict sandwich.txt, then run the command:
$ Svn resolved sandwich.txt
The second way: a new version of the cover with a library of your changes:
$ Cp sandwich.txt.r2 sandwich.txt
$ svn resolved sandwich.txt
The third way: remove your changes, resolved in this way do not need to run sub commands:
$ Svn revert sandwich.txt
Reverted 'sandwich.txt'
$ ls sandwich .*
sandwich.txt
Sure no problem, you can submit a.
$ Svn commit-Message "Correct some fatal problems"
$ svn commit-file logmsg
$ svn commit
(4) test version of history
$ Svn log
$ svn log-Revision 5:19
$ svn log foo.c
$ svn log-v-R 8
$ Svn diff
$ svn diff-Revision 3 rules.txt
$ svn diff-Revision 2:3 rules.txt
$ svn diff-Revision 4:5 http://svn.red-bean.com/repos/example/trunk/text / rules.txt
$ Svn cat-Revision 2 rules.txt
$ svn cat-Revision 2 rules.txt> rules.txt.v2
$ Svn List http://svn.collab.net/repos/svn
$ svn-verbose http://svn.collab.net/repos/svn List
$ Svn Checkout-Revision 1729 # Checks out a new Working Copy at r1729
...
$ svn Revision 1729 Update-# Updates an existing Working Copy to r1729
...
(5) Other useful commands
svn cleanup
For the failed transaction cleared.
(6), branching and merging
The establishment of branch one: first, checkout and then make copies, and submit copies.
$ Svn Checkout http://svn.example.com/repos/calc bigwc
A bigwc / trunk /
A bigwc / trunk / Makefile
A bigwc / trunk / integer.c
A bigwc / trunk / button.c
A bigwc / branches /
Checked out revision 340.
$ Cd bigwc
$ svn Copy trunk branches / My-calc-Branch
$ svn status
A + branches / My-calc-Branch
$ Svn commit-M "Creating a private Branch of / calc / trunk."
Adding branches / My-calc-Branch
Committed Revision 341.
Establish a branch Method Two: Direct remote copy.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Creating a Branch of private / calc / trunk. "
Committed revision 341.
The establishment of a branch, you can checkout the branch and continue your development.
$ Svn checkout http://svn.example.com/repos/calc/branches/my-calc-branch
Suppose you have a trunk checkout, and now want to switch to a branch of development, do the following operations:
$ Cd calc
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/trunk
$ svn Switch http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
Updated to Revision 341.
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/branches/my-calc-branch
Merge file command reference:
$ Svn diff-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn MERGE-R 343:344 http://svn.example.com/repos/calc/trunk
$ svn commit - M "integer.c: ported r344 (Spelling fixes) from trunk."
MERGE $ svn-R 343:344 http://svn.example.com/repos/calc/trunk My-calc-Branch
$ svn MERGE http:/ / svn.example.com/repos/branch1 @ 150 \
http://svn.example.com/repos/branch2 @ 212 \
My-Working-Copy
$ svn MERGE-R 100:200 http://svn.example. COM / repos / trunk-Working-Copy My
$ svn-R 100:200 http://svn.example.com/repos/trunk MERGE
MERGE-Dry $ svn-run-R 343:344 http://svn.example .com / repos / calc / trunk
The last command is just to do the merger test does not perform a merge operation.
Create a label and the establishment of a branch no difference, but just copying to a different directory.
$ Svn Copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-M "Tagging the 1.0 Release of the 'calc 'project. "
$ Ls
-My-Working Copy /
Copy My $ svn-Working-Copy http://svn.example.com/repos/calc/tags/mytag
Committed Revision 352.
The latter directly to the local working copy of the copy for the label.
In addition, you can delete a branch.
$ Svn DELETE http://svn.example.com/repos/calc/branches/my-calc-branch \
-M "Removing OBSOLETE Branch of calc Project."
Management of common commands
(7) repository management
$ Svnadmin Help
...
$ svnadmin Help create
...
$ svnadmin create-FS-type BDB / usr / local / Repository / svn / Test
$ chown-R svn.svn / usr / local / Repository / svn / Test
The establishment of the repository, the library type bdb (Berkeley DB to do with storage), database name is test.
svn repository has two storage methods: based on Berkeley DB (bdb) or file-based system (fsfs), by-fs-type can be specified storage.
(8) queries the repository information
$ Svnlook Help
...
$ svnlook Help Tree
...
Tree $ svnlook / usr / local / Repository / svn / Test-Show-IDS
bash> svn help
usage: svn[Options] [args]
Subversion command line client, version 1.2.0.
Please use the "svn help"Show the help sub-commands.
Most of the sub command file or directory acceptable parameters, recursive directory access.
without specifying parameters to the command, the default will be from the current directory (included) into the
line recursive access .
Available subcommands: (in brackets the abbreviated sub-commands)
add
blame (praise, annotate, Ann)
cat
Checkout (co) / / remove the library from the source copy of a working version of the
cleanup / /
commit (CI) / / submit the current working copy changes. This place is a possible code conflict.
copy (cp) / / make a working copy of the copy.
delete (del, remove, rm) / / delete local or svn server response on the file or directory.
diff (di) / / compare a file in the library corresponds to a different file, similar to the system's diff command. Parameters: the file name.
export / / export a directory tree without version control copy. Generally used for export distribution, or operational version.
Help (?, H)
import / / the local current directory in the file into svn response.
info / / current directory in your working copy of a file (folder) information, such as URL, version, date modified. Parameters: see the file (folder)
List (ls) / / list files under the current working copy, the equivalent of the system ls command, but can only be used in the working copy directory.
lock
log
MERGE / / The difference between the two sources applied to a working copy path.
mkdir / / local or svn respon create a new folder on the Parameters: URL or path to
move (mv, Rename, ren)
propdel (pdel, PD)
propedit (pedit, PE)
propget (pget, pg)
proplist (plist, PL )
propset (psets, PS)
resolved
revert
status (Stat, st) / / svn working copy of the current state of the source with svn server on the results of the comparison.
Switch (SW)
unlock
Update (up) / / sync the svn server-side files to the local
Subversion is a version control system tools.
To obtain more information, please refer to http://subversion.tigris.org/
> Svn co
Checkout (co): Check out a Working Copy from a Repository.
usage: Checkout URL [@ REV] ... [PATH]
If specified, REV determines in which the URL Revision is first
looked up.
If PATH is omitted, the basename of the URL will be used as
the destination. If multiple URLs are given each will be checked
out into a Sub-Directory of PATH, with the name of the Sub-Directory
being the basename of the URL.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read from directory ARG take the user profile
-ignore-externals: ignore externals definitions
SH> svn add
add: files and directories into the version control,
through the dispatch added to archive. They will join the next submission.
Usage: add path ...
Valid options:
-targets arg: pass contents of file ARG as an attachment parameter
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-config-dir arg: from the directory ARG read user configuration files
-force: force operation to run
-auto-props: enable automatic properties and effective
-no-auto-props: enable automatic properties invalid
eg. (The following command must be run in a working copy)
SH> svn add test.c / / add a file
sh> svn add test / / add a directory, the directory structure under any folder
sh> svn import http://localhost/svn/hehehehehhe-m = sdfsdf / / can be in any directory under the current folder so the files recursively into svn response of hehehhhe directory.
SH> svn export
export: to produce a free copy of version control tree.
Usage: 1, export [-R REV] URL [@ PEGREV] [PATH]
2, export [-R REV] PATH1 [@ PEGREV] [PATH2]
1, from the URL specified archive, export a clean directory tree to PATH. If specified
, then REV, content is the revised version, otherwise it is the HEAD revision. If PATH
is omitted, the address (URL) of the last part will be used as a local directory name.
2, in the working copy from a designated PATH1 export a clean directory tree to PATH2. If
REV is specified, then, will be derived from the specified revision, or derived from WORKING. If
PATH2 is omitted, PATH1 the final part will be used as a local directory name.
If REV is not specified, then all the local modifications will be maintained, but not included in the
version control file is not copied.
If you specify PEGREV, starting from the revision specified search.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-q [- quiet]: print as little as possible
-N [- non-recursive ]: only in a single directory operation
-force: force operation to run
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the directory ARG file
-native-eol arg: use a different EOL marker is the standard
file system flag is a local svn: eol-style properties.
ARG may look at one of the 'LF', 'CR', 'CRLF'
-ignore-externals: ignore externals definitions
eg.
SH> svn export http://localhost/svn/hehehehehhhe
SH> svn MERGE
MERGE: the difference between the two sources applied to a working copy path.
Usage: 1, MERGE sourceURL1 [@ N] sourceURL2 [@ M] [WCPATH]
2, N sourceWCPATH2 MERGE sourceWCPATH1 @ @ M [WCPATH]
3, R MERGE-N: M SOURCE [@ REV] [WCPATH]
1, the first form, the source URL is assigned to the revision of the N and M. This is a two
more sources. If the revision is not specified, then defaults to HEAD.
2, in the second form, corresponding to two sources working copy paths define the URL for
the source of comparison. Revision must be specified here.
3, the third form, SOURCE can be a URL or working copy item, which will use the corresponding
address (URL). In the revised version of the REV of the address (URL) will it exist in the revision to the path of N and M for
comparison. If not specified, REV, will be assumed to HEAD.
WCPATH is acceptable to change the working copy path. WCPATH if omitted, the default value
',' unless the principal source of the name in line with '' in a file; In this case, the file
will be directly applied to the difference file to.
Valid options:
-R [- Revision] arg: ARG (some commands need to ARG1: ARG2)
revision argument can be:
number of revision number
"{" date "}" after the specified time Date of revision
"HEAD" recent archives
"BASE" baseline, based on the revision of the work items
"COMMITTED" or baseline before the final submission
"PREV" revision prior to submission
-N [- non-recursive]: operate in a single directory only
-q [- quiet]: print as little as possible
-force: force operation to run
-dry-run: try operation but does not modify
-diff3-cmd arg: use ARG as merge command
-ignore-ancestry: the merger of ignoring the original information
-username arg: specify a user ARG
-password arg: specify a password ARG
-no-auth-cache: do not cache user authentication
-non-interactive: do not interact with prompt
-config-dir arg: read user configuration from the file directory ARG