Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of svn client in operation and maintenance operations

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Client uses:

(If this is the first time you submit a file, you'll probably see "svn:'. 'Not a working copy' means that the current directory is not a working copy. In this case, you need to use import, eg: svn import . url)

1. Checkout files to local directory

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

For example: svn checkout svn://192.168.10.60/jingyu

Abbreviations: svn co

Add a new file to the repository

svn add file

For example: svn add test.php

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

3. Submit the changed file to the repository

svn commit -m "LogMessage" [-N] [--no-unlock] PATH(use the-no-unlock switch if lock is selected)

svn commit -m "add test file for my test" test.php

Abbreviations: svn ci

4. Lock/unlock

svn lock -m "LockMessage" [--force] PATH

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

svn unlock PATH

Update to a version

svn update -r m path

For example:

svn update If there is no subsequent directory, all files in the current directory and subdirectories are updated to the latest version by default.

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

svn update test.php (update, synced with repository. If you are prompted to expire when submitting, it is because of conflict. You need to update first, modify the file, then clear svn resolved, and finally commit)

Abbreviations: svn up

6. View file or directory status

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

【?:Not under svn control;M: content modified;C: conflict occurred;A: scheduled to be added to the repository;K: locked] M states are generally more

svn status -v path(show file and subdirectory status)

The first column remains the same, the second column shows the working version number, and the third and fourth columns show the version number of the last modification and who modified it.

Note: svn status, svn diff, and svn revert are commands that can be executed without a network, because svn keeps an original copy of the local version in the local.svn.

Abbreviations: svn st

7. Delete files

svn delete path -m "delete test fle"

svn delete svn://192.168.10.60/opt/svn/jingyu/test.php-m "delete test file"

Or simply svn delete test.php and then svn ci -m 'delete test file', which is recommended

Abbreviations: svn (del, remove, rm)

8. View logs

svn log path

For example: svn log test.php displays all changes to this file, and changes to its version number

9. View file details

svn info path

For example: svn info test.php

10. Compare differences

svn diff path(compares modified file to base version)

For example: svn diff test.php

svn diff -r m:n path(compare differences between version m and version n)

For example: svn diff -r 200:201 test.php

Abbreviations: svn di

Merge differences between two versions into the current file

svn merge -r m:n path

For example: svn merge -r 200:205 test.php (merge the differences between versions 200 and 205 into the current file, but generally there will be conflicts, which need to be handled)

12. SVN Help

svn help

svn help ci

--------------------------

The above are commonly used commands. Below are a few infrequently used commands.

--------------------------

13. List of files and directories under the version library

svn list path

Displays all files and directories belonging to the repository under the path directory

Abbreviations: svn ls

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-controlled catalog.

Each directory specified by the working copy PATH will be created locally and added to the new schedule for the next commit.

Each directory specified by URL is created by immediate commit to the repository.

In both cases, all intermediate directories must exist in advance.

15. Restore local modifications

svn revert: restores the original working copy file unchanged (restores most of the local modifications).

Usage: revert PATH…

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

Deleted directories

16. Code Base URL Changes

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

Usage: 1. switch URL [PATH]

2、switch -relocate FROM TO [PATH...]

Update your working copy to map to a new URL, which behaves much like "svn update" and merges files on the server with local files. This is the way to map working copies to a branch or tag in the same repository.

Rewrite the URL metadata of the working copy to reflect changes in the URL alone. Use this command to update the working copy mapping to the repository when the root URL of the repository changes (e.g. schema name or host name), but the working copy still maps to the same directory in the same repository.

17. Conflict Resolution

svn resolved: removes the "conflict" status of a directory or file from the working copy.

Usage: resolved PATH…

Note: This subcommand does not resolve conflicts syntactically or remove conflict flags; it simply removes conflicting files and allows PATH to be resubmitted.

Output the contents of a specified file or URL.

svn cat Target [@ version]…If a version is specified, the search will start with the specified version.

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report