quinn quinn - 2 months ago 5x
Git Question

A file is no longer in HEAD revision but can't locate commit where file was deleted

I've scoured my history and have found nothing. I can see commits where it was created and modified, but it no longer exists and I can't figure out where it was deleted.

for example:

git log --full-history --all --diff-filter=D --summary -- path/to/file

returns nothing. Also, just to make sure my working copy wasn't somehow out of sync with git's state (is this even possible?) i tried:

git checkout -- path/to/file

I have also tried * lots * of log commands. I checked on github (where repo is hosted) and file is not that either. I checked to make sure that the last commit I could find the file in was fully merged and it was (
git branch --merged
contains branch with file)

I know that merge commits don't seem to show a log of what changed, is it possible that I accidentally deleted the files during a merge somehow ? Or would that still show up in the log? Is there a way to get some log information on a merge commit?


here is the (abridged) output of this command:

git log --oneline -p -M --follow HEAD -- path/to/file

aaaaa this commit creates it again ?
diff --git a/path/to/file b/path/to/file
new file mode 100644
index 0000000..3333333
--- /dev/null
+++ b/path/to/file

bbbbb this commit modifies it
diff --git a/path/to/file b/path/to/file
index 1111111..2222222 100644
--- a/path/to/file
+++ b/path/to/file

ccccc this commit creates the file
diff --git a/path/to/file b/path/to/file
new file mode 100644
index 0000000..11111111
--- /dev/null
+++ b/path/to/file


If the file has been deleted or renamed, in the output of git log --all --oneline -c -p -- path_to_file it's expected to find --- a/path/to/file +++ /dev/null. That's the commit that deleted or renamed the file. If the deletion or rename happened in a merge commit, -c can output the diff stat too.