0

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. 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).

I basically just typed git status, and saw that a bunch of files in my local repo had been deleted:

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.

6
  • I had a local repository and a remote repository containing all the files. The local repository was changed, but I never committed these changes to the remote repo. Commented Aug 3, 2019 at 20:00
  • When you say "the local repository was changed, but I never committed these changes to the remote repo" do you mean you git commit but never git pushed? Commented Aug 3, 2019 at 20:00
  • No, I never did git commit, I basically typed git status, saw files had been deleted in the local repo, but I never did git add, git commit, etc. Commented Aug 3, 2019 at 20:02
  • All I did was typed git status, and got this: Commented Aug 3, 2019 at 20:04
  • I've tried to clarify the question title. I don't think it's a duplicate (but I don't think it's a git question either). Commented Aug 3, 2019 at 20:04

1 Answer 1

1

If you see something like this from 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.

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.

It looks like you're using a CMS, so it likely happened when some CMS command was run. You can check your command history with history.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.