Reputation: 21
I have one file from Git history in local folder. say 2 months back and post that there are 10-15 commits to this file. Is it possible to find which version (commit) is matching with my local file via any toold or scripts?
Upvotes: 2
Views: 43
Reputation: 522712
You can use git diff
to compare your local file against the revisions from 15 commits ago to the present:
git diff master~15:somefile.txt somefile.txt
git diff master~14:somefile.txt somefile.txt
...
git diff master~1:somefile.txt somefile.txt
When (and if) you see an empty diff, then you have your match. Keep in mind that more than one commit may actually match if, for example, somefile.txt
did not change across several commits.
It is probably also possible to write a more complex script which will loop over versions of the file.
Upvotes: 2