Important:
SVN does not record the actual content of each version, but records the differences between versions.
SVN uses delayed copy to implement SVN copy. It is only a link to the original file. Modifications to the copy are recorded by SVN as modifications to the original file.
1. Create a repository
Assume that D:/dev/svnrepo is the directory for storing the svn repository.
Svnadmin create d:/dev/svnrepo/test create a database named Test
2. Import the project
Assume that your project is in the test folder in D:/dev/eclipse, your current directory is D:/dev/eclipse, and your SVN repository path is http: // localhost/SVN/test
SVN import test http: // localhost/SVN/test/onlytest-M "Initial import"
Description: The content in the test folder is imported.
In addition, make sure to create a path named onlytest.
Otherwise, all data is imported to http: // localhost/SVN/test.-M indicates the log.
3. Export a project
SVN export <project folder> <your folder>
SVN export-r <version> <project folder> <your folder>
-------------------------
4. Retrieve
SVN Co (checkout) http: // localhost/SVN/test/onlytest --- extract the files under the onlytest folder and create the default folder onlytest
SVN co-r <URL> -- get a specific version
SVN Co http: // localhost/SVN/test/onlytest mytest -- remove the files in the onlytest folder and put them in the new folder mytest.
5. Add
SVN add * -- SVN adds files not under version control to Version Control (SVN commit is required)
SVN add -- Non-recursive * Non-recursive Addition
6. Delete
SVN Delete (RM, remove, del) <FILENAME> -- delete files and directories (SVN commit is required)
7. Submit
SVN commit-M "you log" -- submit
SVN commit -- changelist <changelist Name> -- submit the specified changelist
8. Create a directory
SVN mkdir <dirname>
SVN mkdir <URL>
9. Move files or directories
SVN move <source_name> <dist_name>
SVN move <source_url> <dist_url>
10. output the content of a specific file or URL
SVN cat <file or URL> -- output the content of a specific file or URL
SVN cat-r <version> <file or URL>
------------------------------
11. display details of a local or remote file or directory
SVN info <FILENAME>
SVN Info-r <version> <FILENAME>
12. List
SVN list (LS)
SVN list-r <version>
13. Current directory or file status
SVN status <FILENAME>
SVN status -- show-Updates (or-u) from the project repository to find out which files are updated
Status:
Column 1: indicates the status of the entry.
No changes
A add
C conflict
D. Delete
G merge
M Modification
X has no version record and is used by SVN: externals.
? Unused Version Control Management
Column 2: attribute status
No changes
C conflict
M Modification
Column 3: whether the copy is locked
Empty unlocked
L locked
14. Clear
SVN cleanup -- Recursive cleanup of work copies
15. Help
SVN help
SVN help <subcommand> -- displays sub-Command help, for example, SVN help add
-----------------------
18. Lock a directory or file
SVN propset SVN: Needs-lock true <Binary File> -- set the need to lock [SVN will set it to read-only, prompting the user to lock the file before editing]
SVN lock <dir or File>
SVN lock -- force <dir or File> -- force lock on the file, even if the file has been locked by others
19. Unlock
SVN unlock <dir or File>
SVN unlock -- force <dir or File> -- can unlock files locked by other users.
20. display the author and revision of each line of a specific file and URL
SVN blame <file or URL>-each line of text contains the last modified author (User Name) and version number at the beginning.
SVN blame-r <version> <file or URL>
21. Update
SVN update ----
Bringing changes to the version Library to the work copy
SVN update-r <version> -- changed to a specific version.
Status:
A Add add
D. delete Delete
U update
C conflict
M merge
22. find different
SVN diff <File> -- identify the differences between the working version and the last updated version.
SVN diff-C <version> <File> View files<file>
The modified version is compared with version-1.
SVN diff-r <version> <File> View the modification of your work copy to the old version <version>
SVN diff-r <Version1>: <version2> <File> use a range symbol to compare the version <Version1> and <version2>
SVN diff-r <Version1 >:< version2> <URL>
SVN diff -- changelist <changelist Name>
23. Copy
SVN copy <source> <Dist> -- where source and DIST can be either a working directory or a URL
For example, SVN copy foo.txt bar.txt
SVN copy near.txt file: // tmp/repos/test/far-away.txt-M "remote copy ."
SVN copy file: // tmp/repos/test/far-away near-Here
SVN copy file: // tmp/repos/test/far-away file: // tmp/repos/test/over-there-M "remote copy ."
24. Display submitted log information
SVN log-r <version> <path>
SVN log-r <Version1 >:< version2> <path>
SVN log <path>
SVN log-r {iso8601 date} <path>
SVN log-r {iso8601 date }:{ iso8601 date} <path>
SVN log-v <path> displays detailed information (including the files with changes in each version)
SVN log -- stop-on-copy <path> to determine when the branch was created.
25. Delete the "Conflict" of the working copy file or directory.
"Status (related file conflict)
SVN resolved <path>
26. Cancel all local edits
SVN revert <path>
SVN revert -- Recursive <path> Recursion
27. Conflict Resolution
SVN resolve -- accept <status> <path>
Status:
Base: select the unmodified version you checkout before updating your work copy
Working: After manual processing, select the version in the current work copy.
Mine-full: select the work copy before your SVN update
Theirs-full: select the file copy retrieved by SVN update.
28. Put the file into a change list
SVN changelist (CL) <changelist Name> <path1> <path2> <path...>
SVN commit -- changelist <changelist Name> -- submit only the files in the change list.
29. Version Number ID
(1) No. 87
(2) {date} {2009-09-09}
(3) The latest version in the head Repository
(4) The last version you checked out in the base work copy
(5) The last version modified by commited is equal to or earlier than the base
(6) a previous version of Prev commited
30. generation and application Patches
SVN diff> file. Patch
Patch <Options> file. Patch
31. SVN project organization
Project/
Trunk/-- trunk
Branches/-- Branch
Tags/-- tag
32. Common examples
(1) submit changes
SVN update -- Update to the current state of the project
# Resolve conflicts conflict resolution
Edit File
SVN resolved
# Run tests run the test
SVN commit-M "your logs" -- submit
(2) simple bug fixes
A. fix bugs in a branch and submit
B. merge it into other branches with this bug (SVN merge-r <Version1 >:< version2>)
(3) complex bug fixes
A. Create a bug Correction Branch (SVN copy) name = bug-trackID
B. Add a label (SVN copy) name = buuple-trackID before the fix for the branch.
C. Fixed bugs
D. label the fix (SVN copy) name = bugpost-trackID
E. merge this bug to other branches (SVN merge-r buuple-trackID: bugpost-trackID)