The aim of this tutorial is to guide developers by covering the basics of the command-line subversion usage, via the svn command.
As all of you might be knowing,Subversion(svn) is a version control system that keeps track of changes made to files and folders, facilitating data recovery and providing a history of the changes that have been made over time.
Below is the list of all basic svn commands:
1.svn checkout/co:This command is used to check out your code.
svn co svn://svnrepo.
This will checkout the code from the svnrepo with the latest version. If you want to checkout the code for any specific revision number then use this command:
svn co -r <revision number> svn://svnrepo
2. svn add: When you create a new file or directory, you need to tell the SVN server about it. This command does that.
svn add <your file or directory name>
3. svn status: This command prints the status of working directories and files. If you made local changes then it’ll show (M) status in front of your file name.
4. svn update: This command is used to update your code from svnrepo.
This command will update your directory with the latest version. If you want to update your code or want to revert back with any specific revision number you can use:
svn up -r <revision number>
5.svn delete: This command is used to delete file from svnrepo.
svn delete <your file name>
6.svn commit: This command is used to commit your code to svnrepo.
Remember when you use svn add or svn delete, you have to commit your code by using svn commit command. After that your changes will reflect in svnrepo.
How to use svn commit:
svn commit -m “<your message>”.
If you want to commit only a specific file or any specific directory then use this command:
svn commit -m “<your message>” -r <revision number>
svn copy svn://svnrepo svn://yourbranchname .
If you want to create branch for any specific revision number then use this command:
svn copy svn://svnrepo svn:yourbranchname -r <revision number>.So I hope I’ve given you some idea of how to manage the basics of command-line subversion. I will try to write next post with some more advanced examples.