How to discard local changes in an SVN checkout?
I wanted to submit a diff for review, for an Open Source Project.
I got the code using SVN (from terminal, Ubuntu). And I did minor edits in few files. Now there is only a single change I want to submit. Rest of the changes I made, were for debugging, and are no longer required.
I have generated diff using svn di > ~/os/firstdiff.diff
So my question, How to discard my local changes?
Is there a SVN way to do it? If not, I will have to go to each file and delete all my edits. Then I would generate a new diff, and submit it.
Solution 1:
Just use the svn revert
command, for example:
svn revert some_file.php
It is (as every other svn command) well documented in the svnbook resource or man page, or even with the svn help
command.
Solution 2:
You need to revert all the changes using the svn revert command:
- Revert changes to a file:
svn revert foo.c
- Revert a whole directory of files:
svn revert --recursive .
Solution 3:
To discard local changes in one particular file:
$ svn revert example_directory/example_file.txt
To discard local changes in one particular folder:
$ svn revert -R example_directory/