duplicate: What’s a simple way to undelete a file in subversion?
What is the best way to undo removal of a file and keep the file history.
I've removed a file by accident, and commited it along with other changes.
I can get an older revision of the file and add it to svn, but I think this approach will lose change history.
How do I keep the history?
You could try a reverse merge, but if it's a single file, svn copy might be easier:
svn copy file:///var/svn/repos/test/far-away -r 6 near-here
(Search that page for 'recommended')
I can get an older revision of the file and add it to svn, but I think this approach will lose change history
No, it won't. This is the right thing to do. The history will reflect the removal of the file, but also its addition in the subsequent revision. This is what history is -- a record of what happened.
If you remove a file using TortiseSVN's delete menu command or svn rm
, the history is still there. It is not lost unless you mess with the repository more deeply than that.
Revert that file to an earlier revision.
In TortoiseSVN, the easiest way to do this via the Log window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With