svn command use

[/size][size=small]Original details address: http://www.roncoo.com/article/detail/124725
1. Check out

svn co http://path (full path of directory or file) [local directory Full path] --username username --password password [align=left][/align]

svn co svn://path (full path of directory or file) [full path of local directory] --username username --password Password

svn checkout http://path (full path of directory or file) [full path of local directory] --username username

svn checkout svn://path (full path of directory or file) [full path of local directory] -- username Username

Note : If you transmit the password without the --password parameter, you will be prompted to enter the password. It is recommended not to use the --password option in clear text.

  There are two short lines before username and password, not one.

  If the full path of the local directory is not specified, it will be checked out to the current directory.

Example:

[size=xx-small]
svn co svn://localhost/testtools/home/testtools --username wzhnsc

svn co http://localhost/test/testapp --username wzhnsc

svn checkout svn://localhost/testtools/home/testtools --username wzhnsc

svn checkouthttp://localhost/test/testapp --username wzhnsc



2. Export (export a clean directory tree without the .svn folder)

svn export [-r version number] http://path (full path of directory or file) [full path of local directory] --username username

svn export [-r version number] svn://path (full path of directory or file) Full path) [full path of local directory] --username username

svn export full path of the directory checked out locally (that is, with .svn folder) full path of the local directory to be exported

Note : The first is to export cleanly from the repository The form of the working directory tree is the specified URL.

   If the revision number is specified, the corresponding version will be exported.

   If the revision is not specified, the latest version will be exported and exported to the specified location.

   If the full path to the local directory is omitted, the last part of the URL will be used as the name of the local directory.

  The second form is to specify the full path of the locally checked out directory to the full path of the local directory to be exported, and all local modifications will be preserved,

   but not under version control (ie, new files that are not committed, because there is no new file in the .svn folder. related information records) are not copied.

Example:

svn export svn://localhost/testtools/home/testtools --username wzhnsc

svn export svn://localhost/test/testapp --username wzhnsc

svn export /home/testapp /home/testtools



3. Add a new file

svn add filename

Note : To tell the SVN server to add a file, use svn commint - m real upload up!

Example:

svn add test.php <- add test.php

svn commit -m "add my test with test.php" test.php

svn add *.php <- add all php files in the current directory

svn commit -m " Add all php files for my test "*.php



4. Submit

svn commit -m "Submit remark information text" [-N] [--no-unlock] File name

svn ci -m "Submit remark information text" [- N] [--no-unlock] The file name

must be accompanied by the -m parameter. The parameter can be empty, but must be written with -m

Example:

svn commit -m "commit all files under version control in the current directory" * <- Note this * means all files

svn commit -m "commit my test with test.php" test.php

svn commit -m "commit my test with test.php" -N --no-unlock test.php < - Use the --no-unlock switch to keep the lock

svn ci -m "Submit all files under version control in the current directory" * <- Note that * means all files

svn ci -m "Submit my test with test.php" test.php

svn ci -m "Submit My test uses test.php "-N --no-unlock test.php <--no-unlock switch is used to keep the lock



5. Update file

svn update

svn update -r Correct version file name

svn update file name

Example :

svn update <- There is no directory behind, by default all files in the current directory and subdirectories are updated to the latest version

svn update -r 200 test.cpp <- Restore the file test.cpp in the repository to revision 200

svn update test.php <- update sync with repository.

            When submitting, it prompts an expired conflict. You need to update the modified file first,

            then clear the svn resolved, and finally submit the commit.



6. Delete file

svn delete svn://path (full path of directory or file) -m "Delete remark information text"

recommends the following operations:

svn delete file name

svn ci -m "Delete remark information text"

Example:

svn delete svn://localhost/testapp/test.php -m "Delete test file test.php"

recommends the following operations:

svn delete test.php

svn ci -m "Delete test file test.php"



7. Lock/Unlock

svn lock -m "lock remark text" [--force] file name

svn unlock file name

Example :

svn lock -m "test.php file for lock letter test" test.php

svn unlock test.php



8. Compare differences

svn diff filename

svn diff -r revision revision number m: revision revision number n filename

Example :

svn diff test.php <- compares the modified file with the base version

svn diff -r 200:201 test.php <- for revision



Compare the difference between version number 200 and revision              number

201 In control; M: Content is modified; C: Conflict occurs;               A: Scheduled to be added to the repository; K: Locked] svn -v directory path/name









svn status -v directory path/name <- Display file and subdirectory status

              [the first column remains the same, the second column shows the working version number,

               the third and fourth columns show the last modified version number and the person who modified it]

Note: svn The three commands status, svn diff, and svn revert can also be executed without a network,

  because svn keeps the original copy of the local version in the local .svn.



10. View log

svn log file name

Example :

svn log test.php<- Display all modification records of this file and changes in version number



11. View file details

svn info file name

Example :

svn info test.php



12. SVN help

svn help <- All function options

svn help ci <- Description of specific functions



13. View the list of files and directories under the

repository svn list svn://path (full path of a directory or file)

svn ls svn:// Path (full path of directory or file)

example:

svn list svn://localhost/test

svn ls svn://localhost/test <- Display all files and directories belonging to the repository under the svn://localhost/test directory



14. Create a new directory under version control

svn mkdir Directory name

svn mkdir -m "Add directory remark text" http://Directory full path

Example :

svn mkdir newdir

svn mkdir -m "Making a new dir." svn: //localhost/test/newdir

Note: After adding subdirectories, be sure to go back to the root directory to update, otherwise submitting files in this directory will prompt "submission failure"

svn update

Note: If you manually create it in the directory that is checked out After creating a new folder newsubdir and

  using the svn mkdir newsubdir command, SVN will prompt:

  svn: try using "svn add" or "svn add --non-recursive" instead?

  svn: Unable to create directory "hello": the file already exists

  At this point , use the following command to solve it:

  svn add --non-recursive newsubdir

  After entering the newsubdir folder, use ls -a to view all the directories and files under it, you will find More: .svn directory and

  then use svn mkdir -m "add hello function module file" svn://localhost/test/newdir/newsubdir command,

  SVN prompt:

  svn: File already exists: filesystem '/data/svnroot/test/db', transaction '4541-1',

  path '/newdir/newsubdir '



15. Restore local modification

svn revert [--recursive] file name

Note : This subcommand Will not access the network and resolve the conflict condition. But it doesn't restore deleted directories.

Example:

svn revert foo.c <- discard changes to a file

svn revert --recursive . <- restore an entire directory of files, . for current directory



16. Update working copy to another URL

svn switch http:// Directory full path Local directory full path

Example :

svn switch http://localhost/test/456 . <- (the branch of 123) The current directory branches to localhost/test/456



17. Conflict resolution

svn resolved [local directory full path]

Example:

$ svn update

C foo.c

Updated to revision 31.

If you get conflicts while updating, your working copy produces three new files:

$ ls

foo.c

foo.c.mine

foo.c.r30

foo.c.r31

When you have resolved the conflicts in foo.c and are ready to commit, run svn resolved to let your working copy know that you have done everything.

You can just delete the conflicting files and commit, but svn resolved not only deletes the conflicting files, but also fixes some of the log data recorded in the working copy management area, so we recommend you to use this command.



18. View and output the content of a specific file or URL without checkout

svn cat http://file full path

Example :

svn cat http://localhost/test/readme.txt

19. Create a new branch copy

svn copy branchA branchB -m " make B branch" // Copy a new branch branchB from branchA

20. Merge the contents to the branch merge

svn merge branchA branchB // Merge the changes to branchA to branchB[/size]

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326777929&siteId=291194637