This article helps you to understand various SVN commands and its usage in Linux environment.
Table of Contents
- 0.1 This article helps you to understand various SVN commands and its usage in Linux environment.
- 0.1.1 How To get the location of SVN:
- 0.1.2 How to get the SVN help
- 0.1.3 How to get the SVN info
- 0.1.4 How To Check out a code from SVN repository:
- 0.1.5 How To Check in or commit the code into SVN repository:
- 0.1.6 How to get the log from SVN:
- 0.1.7 How to perform SVN update:
- 0.1.9 How to get the SVN status:
- 0.1.10 How to unlock the locked SVN project:
- 0.1.11 How to revert the local changes in the SVN project:
- 0.1.13 How to overcome the issue – File is not under version control:
- 0.1.14 How to Switch the user that has been used for code checkout
- 0.1.15 How to rename a file or directory which is in SVN repository
- 1 Related Posts
How To get the location of SVN:
|$ whereis svn
|$ which svn
How to get the SVN help
|$ svn help
usage: svn <subcommand> [options] [args]
Subversion command-line client, version 1.8.14.
Type ‘svn help <subcommand>’ for help on a specific subcommand.
Type ‘svn –version’ to see the program version and RA modules
or ‘svn –version –quiet’ to see just the version number.Also, lists down all the available options
How to get the SVN info
|$ svn info
Working Copy Root Path: /home/<username>/<svn_project>
URL: <svn repository url>
Relative URL: ^/<svn relative url>
Repository Root: <svn root>
Repository UUID: <>
Node Kind: directory
Last Changed Author: <username>
Last Changed Rev: <revision#>
Last Changed Date: <Date and time>
How To Check out a code from SVN repository:
|$ svn checkout <svn url>
You can create a directory to check out the code there
$ svn checkout <svn url> project
How To Check in or commit the code into SVN repository:
|$svn commit file1, file2, file3
You can commit a directory as well
$svn commit folder_name
Note: If the file or folder is new that has to be added into svn prior commit
How to get the log from SVN:
|$ svn log -l 10
This list down last 10 log history
How to perform SVN update:
|$ svn update
This will update the svn project repository to the head revision
A – Added
U – Local file or directory Updated
M – Merged
D – Deleted
How to get the SVN status:
|$ svn status
This list down all the files which are modified or new or removed from repositoryM – Modified? – New file or folder
! – Removed from repository
A – Added to the repository
U – Local file or directory Updated
How to unlock the locked SVN project:
|$ svn cleanup
The svn project is unlocked
How to revert the local changes in the SVN project:
|First try to get the details of modified files in the project using $svn status
$ svn revert file1, file2….
Local changes will be reverted to the svn revision
How to overcome the issue – File is not under version control:
|This issue may occur when you try to commit the file which was not added to the svn. For instance, there is a file(test1) added in your project and you are trying to commit the test1 file into svn.
$ svn commit test1
The test1 is not under version control.
Now, add the file into svn using $svn add test1 and then perform commit
How to Switch the user that has been used for code checkout
Assume the svn project is being checked out by user1 and that needs to be switched to user2.
$svn update –username=<user2>
$svn update –username <user2>
How to rename a file or directory which is in SVN repository
|Assume file1 is exists in SVN repository and that needs to be changed to file2.
$ svn move file1 file2
Aliases: mv, rename, ren
$svn mv or $svn rename or $svn ren
Please find the svn help snapshot
-bash-4.1$ svn help
Subversion is a tool for version control.
Please leave a comment for any SVN issues or assistance in resolving the same.