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

Re: git log --follow doesn't follow a rename over a merge

From
Jeff King <peff@peff.net>
Date
Jun 16, 2011, 17:45 UTC
Message-ID
<20110616174554.GC6584@sigill.intra.peff.net>
In-Reply-To
<BANLkTi=4S08h=uMV5oo7S9qpruMot2kVfg@mail.gmail.com>
On Thu, Jun 16, 2011 at 06:01:25PM +0100, James Blackburn wrote:
> I see a lot of this has been discussed before... but just to add that
> Jeff's blame-log.sh:
> http://git.661346.n2.nabble.com/alternate-log-follow-idea-td1385917.html
> seems to work and show the full history of the file past the rename+merge!

You may want to also check out the "line-level history browser" work by Bo Yang and Thomas Rast, which is a similar idea, but done much better.

You can find it here:
  http://repo.or.cz/w/git/trast.git/shortlog/refs/heads/line-log-cleanup
or pull it with:
  git pull git://repo.or.cz/git/trast.git line-log-cleanup
Use on a whole file is something like:
  git log -L '1,$':yourfile

But note that it is a work in progress, and I seem to be able to get it to segfault on some simple tests.

Show 5 quoted lines
> I was also interested in whether there's a better way of re-connecting
> history than grafting one repository's history into the commit which
> made it visible in another?  AFAICS the graft is no different to a
> merge commit which contains a rename in the merged node, so I'm
> guessing this is a reasonable thing to do?

Usually you would graft the tip of the old history to the root commit of the new history. So it's not a merge, but makes it look like a contiguous linear history near the graft. But that's only a per-repository thing. If you want to join two histories in the actual history graph, you would merge them; if one supersedes the other, then you would use the "ours" merge strategy to ignore the other side.

I'm not 100% sure I understand your question. Does that answer make sense?

-Peff
Previous: James BlackburnNext: Jeff King
Message 5 of 14 in “git log --follow doesn't follow a rename over a merge”
  1. James BlackburnJun 15, 2011
  2. Jakub NarebskiJun 16, 2011
  3. James BlackburnJun 16, 2011
  4. James BlackburnJun 16, 2011
  5. Jeff KingJun 16, 2011
  6. Jeff KingJun 16, 2011
  7. Junio C HamanoJun 16, 2011
  8. Jeff KingJun 16, 2011
  9. James BlackburnJun 16, 2011
  10. James BlackburnJun 16, 2011
  11. Junio C HamanoJun 16, 2011
  12. James BlackburnJun 16, 2011
  13. James BlackburnJun 16, 2011
  14. James BlackburnJun 16, 2011

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.