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

Re: [BUG] Move tracking in git diff is not as good as in git status

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 5, 2015, 19:01 UTC
Message-ID
<xmqq61bgmbbs.fsf@gitster.dls.corp.google.com>
In-Reply-To
<099A7D2D-6033-4A16-91DD-E2288BC5C729@gmail.com>
"Kyle J. McKay" <mackyle@gmail.com> writes:
Show 29 quoted lines
> On Feb 4, 2015, at 22:11, Scott Schmit wrote:
>
>> In my use of git, I've noticed that "git status" is a lot better at
>> tracking moves and renames than "git diff", and this has recently
>> caused
>> me a lot of headaches because a large number of moves were made in a
>> single commit, and it was very difficult to figure out which moves
>> were
>> right and which were wrong.
>>
>> I was using a fairly old version of git (1.7.11), but was able to
>> reproduce it on git 2.2.1.
>>
>> Here's a reproduction recipe:
> [...]
>> # Now "shift" the files
>> git mv 2 3
>> git mv 1 2
> [...]
>> git commit -m "2=1;3=2;"
>>
>> # Neither of these commands get it (but -C gets a glimmer of the
>> truth)
>> git diff -M --stat --summary HEAD~..
>> git diff -C --stat --summary HEAD~..
>
> Ah, but did you try this:
>
>   git diff -B -M --stat --summary HEAD~..

Yes, since f714fb84 (Enable rewrite as well as rename detection in git-status, 2007-12-02) "git status" internally uses "-B -M".

Previous: Kyle J. McKay
Message 3 of 3 in “[BUG] Move tracking in git diff is not as good as in git status”
  1. Scott SchmitFeb 5, 2015
  2. Kyle J. McKayFeb 5, 2015
  3. Junio C HamanoFeb 5, 2015

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.