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

git patch format for rename

From
NNadya.Zabrodina@jetbrains.com <nadya.zabrodina@jetbrains.com>
Date
Jul 6, 2016, 16:00 UTC
Message-ID
<F58A6A72-4AE5-42FA-843D-66FF809FF1A8@jetbrains.com>
Hi,
could you please explain to me why  ‘rename from & rename to’ information is added to git patch? 
Here is the patch created by `git format-patch`: 
    diff --git a/before.txt b/after.txt
    similarity index 100%
    rename from before.txt
    rename to after.txt
Is there any reason why git can’t recognize and apply rename-change which looks like this:
    diff --git a/before.txt b/after.txt
    --- a/before.txt
    +++ b/after.txt
    
or even like this:
    diff --git a/before.txt b/after.txt
I’m implementing a program (with an IDE) to create patches compatible with Git and want to have better understanding of the format and possible issues with it.
Thanks a lot in advance.
Next: Stefan Beller
Message 1 of 2 in “git patch format for rename”
  1. Nadya.Zabrodina@jetbrains.comJul 6, 2016
  2. Stefan BellerJul 6, 2016

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.