svn command learning

1. Code checkout
downloads the code on the svn server to our computer
svn checkout svn://xxx.com/xxx/xxx
# Specify the storage directory
svn checkout svn://xxx.com/xxx/xxx save-dir
# Specify username and password.
svn checkout svn://xxx.com/xxx/xxx --username xxxx --password xxx

2. Submit the code commit 
to submit the local modification to the svn server
# The description is required, but you can fill in an empty string, without specifying
svn commit -m "commit description"
# Only submit the specified file or directory
svn commit /path/to/file -or-dir -m "Submit specified files"
# All files with specified suffix
svn commit *.js -m "Submit all js files"

3. Update the code update Update
the code submitted by others from the svn server to the local computer
#Update to the latest
svn update
#Update to the specified version of the code. Especially when there is a problem with the latest version code, we can use this command to go back to the previous version
svn update -r xxx 
# Only update the specified file or directory
svn up /path/to/file-or-dir

4. Add files add add
files to svn version management
# Add specified files or directories
svn add /path/to/file-or-dir
# Add all php files in the current directory
svn add *.php

5. Delete the file delete
to remove the file from the svn version control
svn delete /path/to/file-or-dir
# Delete the version control, but the local file is still kept
svn delete /path/to/file-or-dir -- keep-local

6. View the log log
# View the log of the current directory
svn log
# View the commit log of the specified file or directory
svn log /path/to/file-or-dir
# View the log and output the list of changed files
svn log -v
# Limited Only output the latest 5 logs
svn log -l 5

7. View changes diff
# View changes in the current workspace
svn diff
# View changes in specified files or directories
svn diff /path/to/file-or-dir
# Compare differences between local files and specified version numbers
svn diff /path/to/ file-or-dir -r xxx
# Specify the version number to compare differences
svn diff /path/to/file-or-dir -r 1:2 

8. Undo modification revert
# Undo the local modification of the file
svn revert test.php
# Recursively undo the local modification in the directory
svn revert -R /path/to/dir

9. View the status status
View the svn status of the current working directory
svn status
svn status /path/to/file-or-dir

10.
When an error occurs in cleanup svn, you can execute it to clean up the local cache
svn cleanup

11. View information info
svn info

12. View the file list ls
svn ls 
# specify the version number
svn ls -r 100

13. View file content
# View the file content of the specified version, if you do not add the version number, you will view the latest version of
svn cat test.py -r 2

14. Check the blame
to show who modified each line of the file at the end (a bug is found, often used to check who modified this code)
svn blame filename.php

15. Address redirection
If your SVN address has changed, you don't need to checkout the code again, just redirect it like this.
svn switch --relocate original SVN address new SVN address

16. Branch operation
# Create a branch, create a branch from the trunk trunk and save it to branches/online1.0
svn cp -m "Description content" http://xxx.com/repos/trunk http://xxx.com/repos/ branches/online1.0
# Merge the latest code on the trunk to the branch
cd branches/online1.0
svn merge http://xxx.com/repos/trunk 
# Merge the branch into the trunk
svn merge --reintegrate http://xxx. com/repos/branches/online1.0 #
switch branch
svn switch svn://xxx.com/test/branches/online1.0
# delete branch
svn rm http://xxx.com/repos/branches/online1.0

17. Help command
# View SVN help
svn help
# View the help information of the specified command
svn help commit

Guess you like

Origin blog.csdn.net/qq_33782617/article/details/122559710