{"thread":{"id":"16164","subject":"locate commit by file","startedAt":"2008-11-04T08:11:40Z","lastAt":"2008-11-04T09:57:39Z","messageCount":2,"participants":["Ittay Dror","Jakub Narebski"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"94867","messageId":"491003BC.7040206@gmail.com","threadId":"16164","inReplyTo":null,"subject":"locate commit by file","fromName":"Ittay Dror","fromEmail":"ittay.dror@gmail.com","sentAt":"2008-11-04T08:11:40Z","receivedAt":"2008-11-04T08:11:40Z","isPatch":false,"sender":{"key":"ittay.dror@gmail.com","avatar":"https://gravatar.com/avatar/0dc47ece3354a295768075bb5afa328d49cda722c9f3100029ada80ee4561e22?d=mp&s=160"},"body":"Hi,\n\n\nGiven a file, is there an easy way (e.g., not bisectig) to find the \nlatest commit where the file content is the same?\n\n\nMeaning: I have a file /tmp/A and I want to file the latest commit where \na/b/A is identical (content wise) to /tmp/A.\n\n\nThank you,\n\nIttay\n\n\n-- \n--\nIttay Dror <ittay.dror@gmail.com>\n"},{"id":"94880","messageId":"m34p2ng6eq.fsf@localhost.localdomain","threadId":"16164","inReplyTo":"491003BC.7040206@gmail.com","subject":"Re: locate commit by file","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2008-11-04T09:57:39Z","receivedAt":"2008-11-04T09:57:39Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Ittay Dror <ittay.dror@gmail.com> writes:\n\n> Given a file, is there an easy way (e.g., not bisecting) to find the\n> latest commit where the file content is the same?\n> \n> Meaning: I have a file /tmp/A and I want to file the latest commit\n> where a/b/A is identical (content wise) to /tmp/A.\n\nDo you mean: find the commit which changed file to current version?\nI think that\n\n  $ git rev-parse -1 -- file\n\nWould work (but better check \"git log -- file\").\n\nIf you want to find which version corresponds to given contents, you\nwould have to find sha-1 of /tmp/A (using \"git hash-object\"), and\nfind it in difftree searching for sha (\"git log --raw -- file\", or\njust \"git log --raw\" if you are not sure about name).\n\nI think you can fins such script in mailing list archives...\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"}]}