1

I have a full repo, with all commit history, repo

I also have a snapshot of the repo, made sometime in the past. Let's call it snapshot. The snapshot is based on the version of the repo as taken in the past, with some additions/changes.

If I check the differences:

$ diff -wqr repo/ snapshot/  | grep -c differ
538
$ diff -wqr repo/ snapshot/  | grep -cv differ
9

So, I am positive that not that many changes have been made to the master repo: I am simply looking at the wrong repo commit. But which one is the commit were the snapshot was taken?

There are so many differences that I do not know where to start. I know nothing about the repo, so I am clueless of when the snapshot was taken. There is no date information which can point me to a certain period, no VERSION file, nothing ...

What comes to my mind is to take one of the files in the snapshot which differ from the repo, and run a command to see in which commit that file appears verbatim. With some luck, I will get something like:

$ list-commits.sh snapshot/xxx/my-file.py repo
File snapshot/xxx/my-file.py appears verbatim in following commits:
b77ee66
74f6d4f
...

(It could also be that I am by chance chosing one of the files that really changed in the snapshot: in that case I will get no commit list, and I will try another file)

This would limit the commits that I need to investigate. Is there a method of doing this with plain git commands?

blueFast
  • 41,341
  • 63
  • 198
  • 344
  • "Snapshot* is usually used as a synonym of "revision" and "commit". What meaning does it have, in your question? – jub0bs Sep 30 '15 at 19:32
  • 1
    You can use the accepted answer [here](http://stackoverflow.com/questions/223678/which-commit-has-this-blob) combined with `git hash-object` to do what you want (find commits that contain a specific file). – larsks Sep 30 '15 at 19:43
  • @Jubobs: just a version the repo, without the history (no `.git` directory). – blueFast Sep 30 '15 at 19:53
  • Do you have to compare multiple branches? If not, comparing the master branches can be done by adding a remote and using `git log --left-right repo/master...snapshot/master` – Jeremy Fortune Sep 30 '15 at 21:19
  • @jeremytwfortune: as mentioned in the question: the *snapshot* has no history information **at all**. No branches, no commits, no tags, no nothing, just the working dir. – blueFast Oct 01 '15 at 09:57

0 Answers0