在Git中查看已删除的文件 [英] Viewing a Deleted File in Git

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

问题描述

我已经用Git删除了一个文件然后提交,所以这个文件不再在我的工作副本中。我想看看那个文件的内容,但实际上并没有恢复它。


您可以使用显式提交标识符或 HEAD〜n 查看旧版本,或者自删除以来已有多次提交。


I've deleted a file with Git and then committed, so the file is no longer in my working copy. I want to look at the contents of that file, but not actually restore it. How can I do this?

解决方案

git show HEAD^:path/to/file

You can use an explicit commit identifier or HEAD~n to see older versions or if there has been more than one commit since you deleted it.

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

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