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

Re: Git Diff feature request

From
EEErik Cervin Edin <erik@cervined.in>
Date
Jan 3, 2022, 10:14 UTC
Message-ID
<CA+JQ7M-3sswuYzuXy+bs=e26o3btDoK9z3A0j4WVvELoHG5A-Q@mail.gmail.com>
In-Reply-To
<83d398ce-caba-34f7-3727-3e7f5d396127@gmail.com>
On Mon, Jan 3, 2022 at 8:43 AM Nick Gearls <nickgearls@gmail.com> wrote:
>
> When you want to compare 2 versions of a repo you don't own, you don't have the option to apply a formatting standard ...

You may try https://git-scm.com/docs/diff-options#Documentation/diff-options.txt---word-diff-regexltregexgt

  printf 'if (xyz) biz()\n' > bar
  git commit -m 1 bar
  printf 'if (xyz)\n  biz()\n' > bar
  git commit -m 2 bar
  git diff --word-diff-regex='[^[:space:]]' HEAD~
yields a diff with differences hidden
diff --git a/bar b/bar
index 49d380e..05c8e60 100644
--- a/bar
+++ b/bar
@@ -1 +1,2 @@
if (xyz)
  biz()

But from gits perspective, the files are different and the lines are different.
This is the reason having an adhering to a formatting standard is advised,
and something IMHO every serious project should adhere to.
Previous: Nick Gearls
Message 5 of 5 in “Git Diff feature request”
  1. Nick GearlsDec 30, 2021
  2. rsbecker@nexbridge.comDec 30, 2021
  3. Erik Cervin EdinDec 31, 2021
  4. Nick GearlsJan 3, 2022
  5. Erik Cervin EdinJan 3, 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.