git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: locate commit by file

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 4, 2008, 09:57 UTC
Message-ID
<m34p2ng6eq.fsf@localhost.localdomain>
In-Reply-To
<491003BC.7040206@gmail.com>
Ittay Dror <ittay.dror@gmail.com> writes:
Show 5 quoted lines
> Given a file, is there an easy way (e.g., not bisecting) to find the
> latest commit where the file content is the same?
> 
> Meaning: I have a file /tmp/A and I want to file the latest commit
> where a/b/A is identical (content wise) to /tmp/A.

Do you mean: find the commit which changed file to current version? I think that

  $ git rev-parse -1 -- file
Would work (but better check "git log -- file").

If you want to find which version corresponds to given contents, you would have to find sha-1 of /tmp/A (using "git hash-object"), and find it in difftree searching for sha ("git log --raw -- file", or just "git log --raw" if you are not sure about name).

I think you can fins such script in mailing list archives...
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Ittay Dror
Message 2 of 2 in “locate commit by file”
  1. Ittay DrorNov 4, 2008
  2. Jakub NarebskiNov 4, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.