rockstardev
rockstardev

Reputation: 13537

Removing data from a subversion commit?

I recently committed information to a file. Only a few lines of code that are HIGHLY confidential. I need to remove this information from the subversion repository COMPLETELY. How can I do that without reverting and losing changes? It's only in one file? So, is it possible to remove all references to that file, and then re-commit the correct one?

Upvotes: 0

Views: 233

Answers (4)

David W.
David W.

Reputation: 107090

Can you wait until Subversion 1.8 comes out? That's when the highly requested obliterate command is implemented (unless, of course, they've decided to move it to Subversion 1.9 or 2.0).

No. Right?

The only thing you can do is to take down your repository, do a svnadmin dump, filter it to remove the change using svndumpfilter, and reload your repository using svnadmin load. This can be done in a single pipeline, but depending upon your repository size, it could mean being down for a few hours.

I've done this several times. It's no fun, especially when you have to do it at 2:00 in the morning because you can't take down your repository when your developers are busy using it.

Upvotes: 0

Ivan Zhakov
Ivan Zhakov

Reputation: 4041

The only solution is to filter your repository on server side. You should use command like this:

svnadmin create /path/to/newrepos

svnadmin dump /path/to/repos --incremental | svndumpfilter excdlude path/to/remove | svnadmin load /path/to/newrepos

Upvotes: 0

Scott Coldwell
Scott Coldwell

Reputation: 878

SVN provides a command called svndumpfilter that allows you to dump your repository and exclude a path from it. Then, load that dump file into a new repository and that file will be gone.

From http://www.principia-it.co.uk/tools-n-tips/subversion/subversion-faq/7-subversion/10-how-do-i-permanently-remove-paths-from-my-repository

svnadmin dump /path/to/repos > dump.file
svndumpfilter exclude path/to/remove < dump.file > newdump.file
svnadmin load /path/to/newrepos < newdump.file

Upvotes: 1

JB Nizet
JB Nizet

Reputation: 692181

I think you'll have to

  • record the bad commit and every subsequent commit as one or several patches
  • dump the repository
  • create a new repository
  • import all the revisions prior to the bad commit from the dump into the repository
  • reapply each patch in sequence, (and remove the few lines of confidential information before committing)

Upvotes: 1

Related Questions