Now linux is more and more widely used. not only in terms of server applications, but also on the desktop of many of my friends, especially those who are developing, I often use svn under the command line, I searched the Internet for how to use svn under the linux command line, and the results were all a version, some...
Now linux is more and more widely used. not only in terms of server applications, but also on the desktop of many of my friends, especially those who are developing, I often use svn under the command line, I searched the Internet for how to use svn under the linux command line, and the results were all in one version. some errors and errors were incomplete, I want to learn how to use SVN command lines in Linux:
Run the file checkout to the local directory.
Svn checkout path (path is the directory on the server)
Example: svn checkout svn: // 74.125.153.19/pro/fcbu.com
Abbreviation: svn co
Submit the modified file to the version Library.
Svn commit-m "LogMessage" [-N] [-- no-unlock] PATH (if you choose to keep the lock, use the-no-unlock switch)
For example, svn commit-m "add test file for my test" fcbu.com. php
Abbreviation: svn ci
Add new files to the version Library
Svn add file
Example: svn add fcbu.com. php (add fcbu.com. php)
Svn add *. php (add all php files in the current directory)
Update to a specific version
Svn update-r m path
For example:
If there is no directory after svn update, all files in the current directory and sub-directories are updated to the latest version by default.
Svn update-r 233 fcbu.com. php (restore the file fcbu.com. php in the version library to version 233)
Svn update fcbu.com. php (updated for version Library synchronization. If an expiration prompt is prompted during submission, it is because of a conflict. you need to update the file, modify the file, clear svn resolved, and then submit commit)
Abbreviation: svn up
Lock/unlock
Svn lock-m "LockMessage" [-- force] PATH
For example, svn lock-m "lock test file" fcbu.com. php
Svn unlock PATH
View the file or directory status
1) svn status path (the state of the files and subdirectories under the Directory. the normal state is not displayed)
【? : Not under svn control; M: The content is modified; C: A conflict occurs; A: It is scheduled to be added to the version Library; K: It is locked]
2) svn status-v path (displays the status of files and subdirectories)
The first column remains the same, the second column displays the working version number, and the third and fourth columns show the last modified version number and modifier.
Note: svn status, svn diff, and svn revert commands can be executed without a network, because svn is locally deployed. svn retains the original copy of the local version.
Abbreviation: svn st
Delete an object
Svn delete path-m "delete test fle"
For example, svn delete svn: // 74.125.153.19/pro/fcbu.com/fcbu.com.php-m "delete test file"
You can also directly delete svn fcbu.com. php and then svn ci-m 'delete test file'. we recommend that you use this
Abbreviation: svn (del, remove, rm)
View Logs
Svn log path
For example, svn log fcbu.com. php displays all the modification records of this file and changes to its version number.
View file details
Svn info path
Example: svn info fcbu.com. php
Comparison
Svn diff path (compare the modified file with the basic version)
Example: svn diff fcbu.com. php
Svn diff-r m: n path (differences between version m and version n)
Example: svn diff-r 200:201 fcbu.com. php
Abbreviation: svn di
Merge the differences between the two versions into the current file
Svn merge-r m: n path
For example, svn merge-r 200:205 fcbu.com. php (merge the differences between version 200 and version 205 to the current file, but there are usually conflicts. you need to handle them)
Resolve Conflicts
Svn resolved: the "conflict" status of directories or files that remove working copies.
Usage: resolved PATH...
Note: subcommands do not follow the syntax to resolve conflicts or remove conflicting tags. they only remove conflicting tags.
Related files, and then allow the PATH to be submitted again.
The above are common commands. below are a few
List of files and directories in the version Library
Svn list path
Displays all files and directories in the path directory that belong to the version Library.
Abbreviation: 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 control directory.
1. Each directory specified by the working copy PATH will be created on the local end and added to the new
Scheduling to wait for the next submission.
2. Each directory specified with a URL is created by submitting it to the repository immediately.
In both cases, all the intermediate directories must exist in advance.
Restore local modification
Svn revert: restore the original unchanged working copy file (recover most local modifications ). Revert:
Usage: revert PATH...
Note: the sub-commands do not access the network and will release the conflict. But it won't be restored.
Deleted Directory
Code Library URL change
Svn switch (sw): Update the working copy to different URLs.
Usage: 1. switch URL [PATH]
2. switch-relocate from to [PATH...]
1. update your work copy and map it to a new URL. the behavior is similar to "svn update" and
Merge files on the server with local files. This maps the work 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 repository changes
(For example, the solution name or host name change), but the working copy is still mapped to the same directory in the same repository.
This command updates the correspondence between the working copy and the warehouse.
Output the content of the specified file or URL
Svn cat target [@ Version]… If a version is specified, search for it from the specified version.
Svn cat-r PREV filename> filename (PREV is the previous version, you can also write a specific version number, so that the output result can be submitted)
Basically, the commands that may be used are listed above. if you still don't understand them, there is an ultimate method: ask for help from svn. haha:
SVN help usage:
Svn help
Svn help co
With the rapid development of SVN, its functions become more and more perfect and more widely used. it can be used in multiple operating systems. This article is only an entry into the use of Subversion. In fact, it has rich and powerful functions. the above is a commonly used svn command in Linux command lines. if there are any errors, you are welcome to give a message to fcbu.com.