SVN commands under Mac Terminal

Source: Internet
Author: User
Tags diff svn update

Transferred from: http://www.cnblogs.com/luckythan/p/4478706.html

The basic operating procedure for SVN is:

You just entered a new company and asked you to take over an ongoing project, and you opened the terminal and wrote: SVN co Svn://192.168.1.1/pro/domain can then find a project called domain in the current directory, CD domain, You browse a few lines of code, tete, unexpectedly there is a bug, you can't help but change, you have to submit, svn ci-m ' something ', success. You have added a few. php files under domain under the App folder to finish the whole project! You open the terminal again: SVN add domain/app/*.php added successfully. Too good, after work, you went to eat a bowl of their favorite old altar pickled cabbage flavor instant noodles.

Here are some common commands

1. checkout files to a local directory

1 svn checkout path (path is a directory on the server) 2 example: SVN checkout svn://192.168.1.1/pro/domain3 shorthand: SVN co

2 . Add a new file to the repository

1 svn Add file2 example: SVN add test.php (add test.php) 3 svn add *.php (Add all php files in the current directory)

3 . Submit the changed files to the repository

1 svn commit-m "LogMessage" [-n] [--no-unlock] PATH (use –no-unlock switch if hold Lock is selected) 2 for example:
SVN commit-m "Add test file for my test" test.php3 shorthand:
SVN ci

4. Locking/unlock

1 svn lock-m "Lockmessage" [--force] PATH2 Example: SVN lock-m "lock test file" test.php3 svn unlock PATH

5. Update to a version

1 svn update-r m path2 Example: 3 svn update if there is no directory behind it, the default is to update all files in the current directory and subdirectories to the latest version. 4 svn update-r test.php (Restore files from the repository test.php to version 5) SVN update test.php (update, sync in repository. If the prompt expires at the time of submission, it is because of the conflict, you need to update, modify the file, then clear the SVN resolved, and then commit the commit) 6 shorthand: SVN up

6. view file or directory status

1 1) SVN status path (status of files and subdirectories under directory, normal status not shown) 2 "?: not in SVN control; M: content is modified; C: conflict; A: Scheduled to be added to the repository; K: Locked" 3 2) SVN status-v path ( Show file and subdirectory status) 4 The first column remains the same, the second column shows the work version number, and the third and fourth columns show the last modified version number and the modified person. 5 Note: The SVN status, SVN diff, and SVN revert three commands can be executed without a network, because SVN retains the original copy of the local version in. svn. 6 Shorthand: SVN St

7. Delete Files

1 svn delete path-m "delete Test Fle" 2 For example: SVN delete svn://192.168.1.1/pro/domain/test.php-m "Delete test file" 3 or Direct SVN Delete test.php and then svn ci-m ' delete test file ', it is recommended to use this 4 shorthand: SVN (del, remove, RM)

8. View Logs

1 SVN log path2 example: SVN log test.php shows all the changes to this file, and its version number

9. View File Details

1 SVN Info path2 example: SVN info test.php

10. Compare Differences

1 svn diff Path (compare modified file to base version) 2 For example: SVN diff test.php3 svn diff-r m:n path (diff vs. version m and version N) 4 Example: SVN diff-r 200:201 test.php5 Shorthand: SVN di

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

1 svn merge-r m:n path2 For example: SVN merge-r 200:205 test.php (the difference between version 200 and 205 is merged into the current file, but generally conflicts occur and need to be addressed)

12. SVN Help

1 svn help2 svn help CI

13 . List of files and directories under the repository

1 SVN list path2 displays all files and directories belonging to the repository under the path Directory 3 shorthand: SVN ls

14 . Create a new directory under version control

1 svn mkdir: Create a new directory under the included version control. 2 usage: 1, mkdir PATH ... 3 2, mkdir URL ... 4 Create a version-controlled directory. 5 1. Each directory specified in the working copy PATH will be created on the local side and added to the new 6 schedule for the next commit. 7 2, each directory specified as a URL, will be created by submitting it to the repository immediately. 8 in both cases, all intermediate directories must be pre-existing

15. Restore Local modifications

1 svn revert: Restores the original unchanged working copy file (restores most of the local modifications). Revert:2 usage: revert PATH ... 3 Note: The book command will not access the network and will release the conflicting conditions. But it will not recover 4 of the deleted directories

16. Code Base URL Change

1 svn switch (SW): Updates the working copy to a different URL. 2 usage: 1, switch URL [path] 3 2, switch–relocate from to [path ...] 4   5 1, update your working copy, map to a new URL, its behavior is similar to "SVN update", will also be 6 service The files on the device are merged with the local files. This is the 7 method that corresponds a working copy to a branch or tag in the same warehouse. 8 2. Rewrite the URL metadata of the working copy to reflect the changes on the simple URL. When the repository's root URL changes by 9 (such as schema name or hostname change), but the working copy is still mapped to the same directory as the same repository, use the 10 command to update the corresponding relationship between the working copy and the warehouse.

17. Conflict Resolution

1 SVN resolved: Removes the "conflicting" status of the working Copy's directory or file. 2 usage: Resolved PATH ... 3 Note: The book command does not resolve the conflict by syntax or remove the conflict token; it simply removes the conflicting 4 related files and then allows PATH to commit again.

SVN commands under Mac Terminal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.