Svn client command

  

Common svn command description

1. Retrieve the code from the SVN repository to the working copy:

# svn checkout https://svn.sinaapp.com/Appname [workcopy]

where workcopy is optional. If you don't write workcopy, SVN will default to appname as workcopy.

If you only retrieve a version:

# svn checkout https://svn.sinaapp.com/appname/appversion [workcopy]

Retrieve only a version A directory:

# svn checkout https://svn.sinaapp.com/appname/appversion/folder [workcopy]

2. Submit the code to the SVN repository:

# svn commit -m "here is message"

3. Add local files to the working copy:

# svn add something

Note: If something is a file Svn will add this file to the working copy; if something is a directory, svn will add the directory and the files inside it to the working copy. Something can also be a wildcard *, which ignores files that have already been added.

4, delete a file from the working copy:

# svn delete something

Note: If something is a file, svn will delete this file from the working copy; If something is a directory, svn will remove the directory and all the files from the working copy.

5, delete files directly from the SVN repository:

# svn delete -m "delete something" https://svn.sinaapp.com/appname/appversion/something

Note: Individual files or individual directories or even a version can be deleted directly from the SVN repository.

6. Import a local project into the SVN repository:

Import a version of the app:

# svn import localdir https://svn.sinaapp.com/Appname/appversion

Note: Make sure that the appversion of the current app does not conflict.

7. View the status of the file or directory in the working copy:

# svn status [something]

8. Update your working copy:

# svn update

Note: Downloading the latest version from the SVN repository will cause the local uncommitted changes to be lost. It is recommended to check the local copy status (svn status) before using this command.

9, cancel the code modification

Cancel the modification of the code is divided into two cases.

The first case: the change was not committed.

In this case, you can cancel the previous changes by using svn revert.

The usage of svn revert is as follows:

# svn revert [-R] something

Where something can be a relative path (of a directory or a file) or an absolute path.

When something is a single file, directly svn revert something on the line; when something is a directory, you need to add the parameter -R (Recursive, recursive), otherwise it will only change this directory.

In this case, you can also use the svn update command to cancel the previous changes, but it is not recommended. Because svn update will connect to the repository server, it takes time.

Note: svn revert itself is inherently dangerous because its purpose is to abandon uncommitted modifications. Once you choose to restore, Subversion has no way to retrieve uncommitted changes.

The second case: the change has been committed (commit). In this case, use the svn merge command to roll back.

The process of rolling back is as follows:

1) Make sure we get the latest code:

svn update

Suppose the latest version number is 28 .

2) Then find out the exact version number to be rolled back:

svn log [something]

Suppose the version number to be rolled back based on the svn log log is 25, here something can be a file, a directory or an entire project

If you want to know more about the situation, you can use svn diff -r 28:25 [something]

3) Scroll to version number 25:

svn merge -r 28:25 something

To be safe, reconfirm the result of the rollback:

svn diff [something]

Found correct and submitted.

4) Submit rollback:

svn commit -m "Revert revision from r28 to r25,because of ..."

29.

Summarize the above operations into three items as follows:

a. svn update, svn log, find the latest version (latest revision)

b. Find the one you want to roll back Version number (rollbak revision)

c. Use svn merge to roll back: svn merge -r : something

10, view SVN repository log information:

# svn log [ ,null,null,3],Workcopy]

View all local history logs. If workcopy is a file, then it is to view the log information of a file.

View log information for all files in the SVN repository:

# svn log https://svn.sinaapp.com/appname/

This command will view all modified Log.

Note: The SVN service provided by SAE fully supports all the commands of the standard SVN. For more detailed instructions, please refer to the official SVN help documentation.

Copyright © Windows knowledge All Rights Reserved