检查已删除文件的历史记录 [英] examining history of deleted file

查看:42
本文介绍了检查已删除文件的历史记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在 Subversion 中删除了一个文件,我如何查看它的历史和内容?如果我尝试对不存在的文件执行 svn catsvn log,它会抱怨该文件不存在.

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.

另外,如果我想恢复文件,我应该svn add把它放回去吗?

Also, if I wanted to resurrect the file, should I just svn add it back?

(我专门询问了 Subversion,但我也想了解 Bazaar、Mercurial 和 Git 如何处理这种情况.)

(I asked specifically about Subversion, but I'd also like to hear about how Bazaar, Mercurial, and Git handle this case, too.)

推荐答案

要获取已删除文件的日志,请使用

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

无论如何,不​​要使用svn up"来恢复被删除的文件!

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

这篇关于检查已删除文件的历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆