[英]How can I find when a file was deleted in a local Git working directory?
I was recently making some changes to a local Git repo, and I saw that a bunch of files had been deleted from the local repository. 最近,我对本地Git存储库进行了一些更改,我发现一堆文件已从本地存储库中删除。 I hadn't committed these changes, so the files weren't actually deleted on the remote Git repo, but I'm still curious as to when these files were deleted on my local machine (as I don't recall deleting anything, and I would definitely never delete these files).
我尚未提交这些更改,因此实际上并没有在远程Git存储库上删除这些文件,但是我仍然对何时在本地计算机上删除这些文件感到好奇(因为我不记得删除任何内容,并且我绝对不会删除这些文件)。
I basically just typed git status
, and saw that a bunch of files in my local repo had been deleted: 我基本上只是输入
git status
,然后发现本地存储库中的一堆文件已被删除:
modified: .DS_Store
deleted: _posts/2019-06-06-First-Post.markdown
deleted: _posts/2019-06-07-Probduct-Update.markdown
deleted: _posts/2019-06-28-Project-Update.markdown
deleted: about.md
modified: assets/.DS_Store
deleted: assets/graph.png
I don't know how or why these files got deleted, that is what I'm interested in figuring out. 我不知道如何或为什么删除这些文件,这是我感兴趣的解决方法。
If you see something like this from git status
... 如果您从
git status
看到类似的内容...
On branch gh-pages
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .DS_Store
deleted: _posts/2019-06-06-First-Post.markdown
deleted: _posts/2019-06-07-Ignite-Labs-Probduct-Update:-Inferno-v0.0.1(b).markdown
deleted: _posts/2019-06-28-Project-Update.markdown
deleted: about.md
modified: assets/.DS_Store
deleted: assets/graphy_boi.png
That means they were deleted from your filesystem. 这意味着它们已从您的文件系统中删除。 Git has no record of that.
Git没有任何记录。
Things like the filenames and modification times are stored in the directory, the modification time of the directory will change whenever any files are changed, renamed, added, or deleted. 文件名和修改时间之类的东西都存储在目录中,只要更改,重命名,添加或删除任何文件,目录的修改时间就会改变。
ls -ld _posts/ assets/
will show you the last time this happened, though it won't necessarily be when those specific files were deleted. ls -ld _posts/ assets/
将向您显示上一次发生的时间,尽管不一定是删除这些特定文件的时间。
It looks like you're using a CMS, so it likely happened when some CMS command was run. 看来您使用的是CMS,因此可能是在运行某些CMS命令时发生的。 You can check your command history with
history
. 您可以使用
history
检查命令历史history
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.