examining history of deleted file

bazaar, svn, version-control

Solution

To get the log of a deleted file, use

svn log -r lastrevisionthefileexisted

If you want to resurrect the file and keep its version history, use

svn copy url/of/file@lastrevisionthefileexisted -r lastrevisionthefileexisted path/to/workingcopy/file

If you just want the file content but unversioned (e.g., for a quick inspection), use

svn cat url/of/file@lastrevisionthefileexisted -r latrevisionthefileexisted > file

In any case, DO NOT use 'svn up' to get a deleted file back!

Problem

If I delete a file in Subversion, how can I look at it's history and contents? If I try to do `svn cat` or `svn log` on a nonexistent file, it complains that the file doesn't exist. Also, if I wanted to resurrect the file, should I just `svn add` it back? (I asked specifically about Subversion, but I'd also like to hear about how Bazaar, Mercurial, and Git handle this case, too.)

Original source

Related problems