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

Re: Git diff misattributes the first word of a line to the previous line

From
Bagas Sanjaya <bagasdotme@gmail.com>
Date
Oct 13, 2022, 12:16 UTC
Message-ID
<1ebea198-fa2a-3f79-e698-64fa4799bcde@gmail.com>
In-Reply-To
<CABwTF4U-KXHF7=8RWY7Ecbspz205Msa3syZFiWYDg3XmZsNGVw@mail.gmail.com>
On 10/13/22 12:51, Gurjeet Singh wrote:
Show 10 quoted lines
> # **** Expected **** output
> $ git diff --word-diff=plain /tmp/1.txt /tmp/2.txt
> diff --git a/tmp/1.txt b/tmp/2.txt
> index 8239f93..099fb80 100644
> --- a/tmp/1.txt
> +++ b/tmp/2.txt
> @@ -1,2 +1,2 @@
>     x = yz {+opt1+}
>     [-ab-]{+ac+} = [-cd ef-]{+pq opt2+}
> 
What Git version (and on what system) you made the expected diff above?
-- 
An old man doll... just what I always wanted! - Clara
Previous: Philip Oakley
Message 4 of 4 in “Git diff misattributes the first word of a line to the previous line”
  1. Gurjeet SinghOct 13, 2022
  2. Johannes SixtOct 13, 2022
  3. Philip OakleyOct 13, 2022
  4. Bagas SanjayaOct 13, 2022

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.