Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Remove added files using svn add

Answer:

To remove files from committed into the SVN in the next commit if you have just added them using the svn add, you should use svn revert

e.g.

# svn revert file.txt

How to revert a bad commit in SVN

Answer:

In SVN, if you have committed something wrong, how do you rollback it?

You cannot use the svn revert command since it has been commited, you need to do a merge instead

E.g. Rollback from current version to revision 98

# svn merge -r HEAD:98 http://example.com/svn/repos/demo/trunk
# svn commit -m "Reverting previous bad commit and going back to revision 98"

Import files and directories into a SVN repository

Answer:

To import files and directories into a SVN repository, you can use the svn import command.

E.g.

Import all files and directories under the current working directory "project1" to a local SVN repository

# cd /data/project1
svn import file:///data/svn/project1

Create a SVN Repository on local drive

Answer:

To create a SVN Repository on local drive, you can use the following command:

# cd /data/
# svnadmin create svn

Now you have created a SVN repository located at file:///data/svn/

Print SVN log in chronical order

Answer:

To print the svn log in chronical order (according to the time they occured)

# svn log -r1:HEAD

Replace the -r1 with the revision you needed.