Ubuntu, using svn from terminal

Hello everybody,

One day I had problems with GUI svn client and a big headache how to commit my changes. I have found how to do that using Terminal and from that moment I’m not using any single GUI svn client :))

1. Getting svn sources from the svn repository:
— Go to the folder you want to make you project’s folder and type a simple command:

~$ svn co ‘here address of svn repo’

emaple: svn co https://crossfire.svn.sourceforge.net/svnroot/crossfire
If svn is not installed, just type:

~$ sudo apt-get install subversion

— Nano editor is needed for adding comments

~$ sudo apt-get install nano

2. Updating sources from the svn:
— Go to the your project’s root directory, example: /home/yahor/projects/some_project/trunk <--- and then there are going project structure, so trunk is a root project's folder, then type: ~$ svn up — Yep, only 2 words :)) 3. Adding/Removing files and directories into svn:
— a) Go to the root dir of the project or b) go to the file via all folders, so if you type ‘ls’ you will see this file
a1) ~$ svn add ~/projects/some_project/some_folder/some_file_to_add.java
a2 – you are in the root proj dir) ~$ svn add some_folder/some_file_to_add.java
b – you in the file’s dir) ~$ svn add some_file_to_add.java
To remove files, change ‘add’ in the command to ‘remove’ 🙂
— After you have added/deleted the file, you need to do a commit to apply changes!

4. Committing added/deleted/modified files:
— Single File choosing logic is same as for delete and add, just another command is used
— If you want to commit many files, just list them after ‘ci’ using space between file paths
— If you want to commit all changes, just type ‘snv ci’ like ‘svn up’

~$svn ci file_to_commit.java
~$svn ci file_to_commit.java file_to_commit2.java
~$svn ci

— After you will hit the enter, you will see nano editor (sudo apt-get install nano) text enter area for commit comment, and list of files you are going to commit. To complete commit do following:
1. Enter comment;
2. Hit CTRL+X;
3. Confirm changes ‘Y’;
4. Hit Enter;
5. Enjoy 🙂

5. Svn status or how to check the state of the project
It is very simple to check what files are modified, added or removed:
— Type a command in the project’s root folder and it will list all modified files
— Then you can type ‘svn ci’ and copy using clipboard all files you want to commit delimiting them by space!

~$svn status

6. Revert your current working copy revision to the previous or custom revision:

~$svn up -r REVISION_NUMBER

7. Get revisions history:

~$svn log

8. Do not hesitate to use grep (use man grep to find more info) for searching necessary modifications in the project:
(Show only modified files)

~$svn st | grep ^M.*

Very simple and useful.

Happy subversioning (:

Best regards,
Yahor