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

Which file is older in history?

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Mar 20, 2013, 20:21 UTC
Message-ID
<CALkWK0nTjoR9qBY-hnkrDKnyf8088ZDJ1LK_zNqAoAB7ndvaww@mail.gmail.com>
Hi,

I want to compare two files in a git repository and tell which one was introduced into the repository earlier, assuming that they're in the same history line (by ancestry, not timestamp). The naive way to do this is to find the individual commits that introduced the files (`rev-list HEAD -- <filename> | tail -n 1`), and query whether there are commits between them (`rev-list commit1 ^commit2`). However, this is slow. What about bisecting the history until we find a tree that contains one file but not the other?

Thanks.
Ram
Next: Junio C Hamano
Message 1 of 7 in “Which file is older in history?”
  1. Ramkumar RamachandraMar 20, 2013
  2. Junio C HamanoMar 20, 2013
  3. Ramkumar RamachandraMar 21, 2013
  4. Jeff KingMar 21, 2013
  5. Jeff KingMar 21, 2013
  6. Ramkumar RamachandraMar 21, 2013
  7. Jeff KingMar 21, 2013

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.