0

I had a file "config.ru" in one of my branches (I can't remember which one), and at some point I added it to ".gitignore" (which may or may not be relevant -- I'm not sure).

Now I would like to find it in my history and view it. I have tried git log --all -- config.ru but it produced no results. How can I find the file?

CharlesB
  • 80,832
  • 27
  • 184
  • 208
Jonah
  • 15,225
  • 21
  • 83
  • 152
  • was it at the root of the repo? – CharlesB Oct 11 '13 at 17:25
  • Yes, it was. But for future reference, in addition to my OP, I'd like to know how to search the entire repo (eg, if I forgot everything about the location but the filename) if that's possible – Jonah Oct 11 '13 at 17:36
  • see http://stackoverflow.com/q/372506/11343 : `git log --all -- **/config.ru`. So if it doesn't find anything the file was never tracked in any branch. Sorry – CharlesB Oct 11 '13 at 18:09

1 Answers1

1

you can try

git log --all --stat | grep -10 "config.ru"

--stat option shows the commit log with filename.

or

git log --walk-reflogs --stat | grep -10 "config.ru"

--walk-reflogs option shows the reflog commit intead of walking the commit ancestry chain.

ton
  • 1,404
  • 12
  • 10
  • now that is a "ton" of useful information. so if i'm still not finding it, it means i must have been mistaken and never committed it before adding to .gitignore, correct? – Jonah Oct 11 '13 at 18:33
  • Note that there's no reason the result can be different to the OP's command `git log --all -- filepath` – CharlesB Oct 11 '13 at 19:12