Re: Git Diff feature request
- From
- Erik 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.