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

What is the usage of the svn command on the Linux system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

What is the usage of svn command in Linux system? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1. Checkout the file to the local directory

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

For example: svn checkout svn://192.168.1.1/pro/domain

Abbreviation: svn co

2. Add new files to the version library

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 files to the version library

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

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

Abbreviation: svn ci

4. Lock / unlock

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

For example: svn lock-m "lock test file" test.php

Svn unlock PATH

5. Update to a certain version

Svn update-r m path

For example:

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

Svn update-r 200 test.php (restore the file test.php in the version library to version 200)

Svn update test.php (updates, synchronized with the version library. If you are prompted to expire at the time of submission, it is due to a conflict. You need to update first, modify the file, then clear svn resolved, and then submit commit)

Abbreviation: svn up

6. Check the status of a file or directory

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

[?: not under the control of svn; M: content modified; C: conflict occurred; A: scheduled to be added to version library; K: locked]

2) svn status-v path (showing 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 last modified version number and modifier.

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

Abbreviation: svn st

7. Delete files

Svn delete path-m "delete test fle"

For 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

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

9. View file details

Svn info path

For example: svn info test.php

10. Compare the differences

Svn diff path (compare modified files with base version)

For example: svn diff test.php

Svn diff-r MVA n path (compare the difference between version m and version n)

For example: svn diff-r 20014 0201 test.php

Abbreviation: svn di

11. Merge the differences between the two versions into the current file

Svn merge-r mpurn path

For example: svn merge-r 200 svn merge 205 test.php (merge the differences between versions 200 and 205 into the current file, but there are usually conflicts that need to be dealt with)

12. SVN help

Svn help

Svn help ci

--

The above are common commands. Here are a few that are not commonly used.

--

13. List of files and directories under the version library

Svn list path

Show all files and directories that belong to the version library 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-controlled directory.

1. Each directory specified with the working copy PATH will be created on the local side and added

Schedule for the next submission.

2. Each directory specified in URL is created by immediately submitting it to the repository.

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

15. Restore local modifications

Svn revert: restore the original working copy file (restore most of the local modifications). Revert:

Usage: revert PATH...

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

Deleted directory

16. Code base URL changes

Svn switch (sw): update the working copy to a different URL.

Usage: 1. Switch URL [PATH] 2, switch-relocate FROM TO [PATH …]

1. Update your working copy and map it to a new URL, which behaves like "svn update" and will also change the

Files on the server are merged with local files. This corresponds to a working copy to a branch or tag in the same warehouse

Method.

2. Rewrite the URL metadata of the working copy to reflect the changes on the simple URL. When the root URL of the warehouse changes

(such as a change in the scheme name or host name), but the working copy is still used when mapping to the same directory in the same warehouse

This command updates the correspondence between the working copy and the warehouse.

My example: svn switch-relocate

17. Conflict resolution

Svn resolved: removes the "conflict" state of the directory or file of the working copy.

Usage: resolved PATH...

Note: this subcommand does not resolve conflicts or remove conflict tags according to syntax; it just removes conflicts

Related documents, and then let PATH can submit again.

Output the contents of the specified file or URL.

Svn cat target [@ version]... If a version is specified, the search starts with the specified version.

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

19 、 .

Attached: notice of joining Email for SVN

You can add SVN to the mailing list function through Subversion's Hook script

After compiling and installing Subversion, there is a Perl script for comm-email.pl under the source code tools, and there is a hooks directory in your file directory. Go to the hooks directory and rename post-commit.tmpl to post-commit and give it executable permission.

Change the post-commit script to add the correct path of the comm-email.pl script, otherwise SVN will not find the comm-email.pl

REPOS= "$1"

REV= "$2"

/ usr/local/svn / resp/commit-email.pl "$REPOS"$REV" email@address1.com email@address2.com

# log-commit.py-repository "$REPOS"-revision "$REV"

What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.

After reading the above, have you mastered the usage of the svn command in Linux system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Development

  • How does HTML invoke the search engine in the page?

    This article is about how HTML invokes search engines on the page. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

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

    12
    Report