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

Different behaviour for --find-renames between git diff and git merge?

From
LBLuca Balsanelli <lucabalsanelli@gmail.com>
Date
Dec 12, 2025, 18:04 UTC
Message-ID
<3742e7de-7d88-4e77-b711-9fed867a8c23@gmail.com>
Hi,
   I'm scratching my head to understand why on the following case `git 
diff` and `git merge` give a different interpretation about a rename.
    git switch master
    touch aaa
    git add aaa
    git commit -m 'aaa'
    git switch -c branch
    echo -en 'A\nB\nC\n' > aaa
    git add aaa
    git commit -m 'A\nB\nC\n > aaa'
    git switch master
    echo -en 'A\nB\n' > aaa
    mkdir dir
    mv aaa dir/
    git add aaa dir/
    git commit -m 'A\nB\n > aaa -> dir/'
The `|merge.renames` config variable is true. Changing `git diff 
--find-renames=50%` (the default) or `git merge -s ort -X 
find-renames=50%` ||to something lower does not change the following.
|
`git diff` prints
    diff --git a/aaa b/dir/aaa
    similarity index 71%
    rename from aaa
    rename to dir/aaa
    index bbd2b90..986ad36 100644
    --- a/aaa
    +++ b/dir/aaa
    @@ -1,4 +1,3 @@
      A
      B
    -C
     that is the similarity index is 71% and it detects the rename.
`git merge branch`, instead, gives
    CONFLICT (modify/delete): aaa deleted in HEAD and modified in
    branch.  Version branch of aaa left in tree.
    Automatic merge failed; fix conflicts and then commit the result

Why it is that? I always supposed that the rename detection was the same for `git diff`, `git merge`. Reading the documentation I do not find any hint why `git diff` and `git merge` are behaving differently.

Thanks,
Luca Balsanelli
Next: Elijah Newren
Message 1 of 6 in “Different behaviour for --find-renames between git diff and git merge?”
  1. Luca BalsanelliDec 12, 2025
  2. Elijah NewrenDec 13, 2025
  3. Luca BalsanelliDec 15, 2025
  4. Elijah NewrenDec 16, 2025
  5. Luca BalsanelliDec 16, 2025
  6. Elijah NewrenDec 16, 2025

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.