Svn use under linux (svn command)

  

1, checkout the file to the local directory

svn checkout path (path is the directory on the server)

Example: svn checkout svn ://192.168.1.1/pro/domain

Abbreviation: svn co

2, add a new file to the repository

svn add file

For example: svn add test.php (add test.php)

svn add *.php (add all php files in the current directory)

3, submit the changed file to the version Library

svn commit -m “LogMessage“ [-N] [–no-unlock] PATH (if you choose to keep the lock, use – no-unlock switch)

For example :svn commit -m “add test file for my test<quo; test.php

Abbreviation: svn ci

4, lock/unlock

svn lock -m &ldquo ;LockMessage“ [–force] PATH

Example: svn lock -m “lock test file“ test.php

svn unlock PATH

5, update to a Versions

svn update -rm path

Example:

svn update If there is no directory behind, the current directory and subdirectories will be selected by default. All files under are updated to the latest version.

svn update -r 200 test.php (restore the file test.php in the repository to version 200)

svn update test.php (update, sync in repository. If in When the submission is overdue, it is because of conflict, you need to update, modify the file, then clear svn resolved, and finally submit commit)

Abbreviation: svn up

6, view files or directories Status

1)svn status path (the status of files and subdirectories under the directory, normal status is not displayed)

[?: not in the control of svn; M: the content is modified; C: Conflict occurs; A: scheduled to join the repository; K: locked]

2) svn status -v path (display file and subdirectory status)

The first column remains the same, second column shows the working version, the third and fourth columns show the last modified version and modify people.

Note: The three commands svn status, svn diff, and svn revert can be executed without a network. The reason is that svn keeps the original copy of the local version in the local .svn.

Abbreviation: svn st

7, delete file

svn delete path -m “delete test fle“

Example: svn delete svn://192.168.1.1/pro/domain/test.php -m “delete test file”

or directly svn delete test.php and then svn ci -m ‘delete test file‘, recommend this

Abbreviation: svn (del, remove, rm)

8, view the log

svn log path

Example: svn log test.php Show this Changes to all changes to the file, and changes to its version number

9. View file details

svn info path

Example: svn info test.php

10, compare differences

svn diff path (compare the modified file with the base version)

Example: svn diff test.php

svn diff -rm:n Path (comparison between version m and version n)

Example: svn diff -r 200:201 test.php

Abbreviation: svn di

11, will be two The differences between versions are merged into the current file

svn merge -rm:n path

For example: svn merge -r 200:205 test.php (the difference between versions 200 and 205 Merge to The previous file, but generally there will be conflicts, need to be dealt with)

12, SVN Help

svn help

svn help ci

—— & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash;

These are the common commands, write the following
several not often used

& mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash; & mdash ;————————————

13, list of files and directories under the repository

svn list path

Show all files and directories belonging to the repository in the path directory

Abbreviation: svn ls

14, create a new directory under version control

svn mkdir: Create a new directory under version control.

Usage: 1, mkdir PATH…

2, mkdir URL…

Create a version control directory.

1. Each directory specified by the working copy PATH will be created on the local side, and a new

schedule will be added for the next commit.

2, each to the directory specified URL will be created in the repository via an immediate commit.

In both cases, all the intermediate directories must already exist.

15. Restore local modifications

svn revert: Restore original unchanging working copy files (recover most local modifications). Revert:

Usage: revert PATH…

Note: This subcommand does not access the network and will resolve the conflict. But it won't recover

Deleted directory

16, codebase URL change

svn switch (sw): Update working copy to a different URL.

Usage: 1, switch URL [PATH]

2, switch –relocate FROM TO [PATH…]

1, update your working copy, map to a The new URL, which behaves much like “svn update”, also merges files on the

server with local files. This is a

method that maps a working copy to a branch or tag in the same repository.

2, rewrite the URL metadata of the working copy to reflect the changes on the simple URL. Use the

command to update the working copy and repository when the root URL of the repository changes

(such as the program name or host name changes), but the working copy is still mapped to the same directory in the same repository. Correspondence.

17.Resolve conflicts

svn resolved: Remove the "conflict" status of the directory or file of the working copy.

Usage: resolved PATH…

Note: This subcommand does not resolve conflicts by grammar or remove conflict tags; it simply removes conflicting

related files. Then let PATH submit again.

18. Output the contents of the specified file or URL.

svn cat target [@version]… if a version is specified, it will be looked up from the specified version.

svn cat -r PREV filename > filename (PREV is the previous version, you can also write the specific version number, so the output can be submitted)

Copyright © Windows knowledge All Rights Reserved