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

Re: How to fix (and find) many git-* --check errors?

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2008, 19:27 UTC
Message-ID
<7viqubcnop.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<489C40BC.8000008@sneakemail.com>
"Peter Valdemar Mørch (Lists)"  <4ux6as402@sneakemail.com> writes:
Show 6 quoted lines
> We have > 37000 white space "errors" in HEAD, mostly trailing
> whitespace, and I'm looking for a
>
> $ git diff --check | git??? --whitespace=fix
>
> command.
Starting from a clean checkout, you could do something like this:
	$ git reset --hard
        $ rm .git/index
        $ git diff --binary -R HEAD >P.diff
        $ git apply --whitespace=fix --cached <P.diff
	$ git commit -m "Fixed all whitespace gotchas"

P.diff contains essentially everything, and you are recreating everything from that patch.

Previous: Peter Valdemar Mørch (Lists)Next: Peter Valdemar Mørch (Lists)
Message 5 of 6 in “How to fix (and find) many git-* --check errors?”
  1. Peter Valdemar Mørch (Lists)Aug 8, 2008
  2. Jeff KingAug 8, 2008
  3. Björn SteinbrinkAug 8, 2008
  4. Peter Valdemar Mørch (Lists)Aug 8, 2008
  5. Junio C HamanoAug 8, 2008
  6. Peter Valdemar Mørch (Lists)Aug 9, 2008

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.