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
James Blackburn <jamesblackburn@gmail.com>
Date
Jun 16, 2011, 19:41 UTC
Message-ID
<BANLkTin19sx9_+VKwD5TSxxJjHMZT-JoYQ@mail.gmail.com>
In-Reply-To
<20110616181509.GA12689@sigill.intra.peff.net>
On 16 June 2011 19:15, Jeff King <peff@peff.net> wrote:
> This test case shows full-history helping:
This test shows what I've done:
commit() {
 echo $1 >>$1 && git add $1 && git commit -m $1
}

git init repo cd repo commit one commit two commit three

git symbolic-ref HEAD refs/heads/newroot rm * git rm --cached * commit four commit four commit four commit four commit four commit four commit five

git checkout master git merge --no-commit newroot

git mv four four2 commit six commit four2 commit five

git log --graph --oneline
* 7c4c441 five
* 02a7262 four2
*   6ac2fe0 six
|\
| * d4f5e35 five
| * 350d3e9 four
| * b975d48 four
| * 3bdbf38 four
| * 5b58da8 four
| * 9fb4f59 four
| * a6d1492 four
* b301c9c three
* 38865e2 two
* 9a9c689 one
At this point, only git-blame seems correct:
> git blame -- four2
Correct
> git log --oneline -- four2

02a7262 four2 6ac2fe0 six

> git log --follow --oneline -- four2
02a7262 four2
>From the above: I can't log past four2 (without using  blame-log.sh).
> git log -- four
 <no output>
> git log --follow --oneline -- four

350d3e9 four b975d48 four 3bdbf38 four 5b58da8 four 9fb4f59 four a6d1492 four

>From above: I can't log four without doing '--follow', and the output
is missing the deletion in the merge commit.
Log of 'five', which hasn't been renamed, looks ok.
James
Previous: Jeff KingNext: James Blackburn
Message 9 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.