I've tried googling for a solution to this problem but haven't yet found one.
Given a working directory named '/project', I'm trying to find a way of telling if git has ever in the history of the repository tracked a file named '/project/x/y/fubar'.
Is this possible? It seems like the kind of thing that should have an answer already but my google-Fu is failing me this morning.
Edit: possible duplicate at How to tell if a file is git tracked (by shell exit code)?
I don't consider that question the same as this one because the file I'm trying to get information on is not guaranteed to be currently tracked by git, and may not exist in the working dir at calling time. The answers to that question all seem to tell you if the file is currently being tracked by git. Please tell me if I'm wrong and one of those solutions is acceptable for my goal.
Simplest would be git log --all -- x/y/fubar
- if the file was there, it would have give atleast one log entry.
A nicer approach would be:
git log --all --pretty=format: --name-only --diff-filter=A | sort - | grep fubar
Merged from a couple of other answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With