Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Revert a file on SVN repository but keep local version

I accidentally committed some changes to the repository that were not complete. I do not want to lose my local changes, but i want to revert the file in the repository to where i was before i committed the changes.

like image 385
Michael Avatar asked Jun 21 '10 20:06

Michael


People also ask

Does svn update overwrite local changes?

Subversion is pretty smart about updating and never just overwrites files that have local changes with copies from the repository. The most important thing to take away from this section is: If you collaborate with others on one repository, remember to update your working copy regularly.

What does revert in svn do?

svn revert will revert not only the contents of an item in your working copy, but also any property changes. Finally, you can use it to undo any scheduling operations that you may have performed (e.g., files scheduled for addition or deletion can be “unscheduled”).

How do I revert a directory in svn?

To revert single change (e.g. made in revision 666): cd folder svn merge -c -666 . To revert local changes (not committed yet): cd folder svn revert -R .


1 Answers

Not sure if there is a feature to do this. But what I would do is

  1. Take your file and copy it into a separate directory [like on your desktop].
  2. In your SVN directory, revert that specific file to the
    previous version.
  3. Commit that version so it's now the HEAD version.
  4. Get your file from the desktop and copy it back in, and overwrite it and don't check it
    in.
like image 131
Jack Marchetti Avatar answered Sep 22 '22 06:09

Jack Marchetti