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

Ignoring whitespace for diff and rebase

From
LNLars Noschinski <lars-2008-1@usenet.noschinski.de>
Date
Aug 15, 2008, 18:59 UTC
Message-ID
<20080815185920.GA3646@lars.home.noschinski.de>
Hello!
Sometimes, I use
     git diff -b > ~/tmp/patch
     git reset --hard HEAD
     git apply ~/tmp/patch

to clean up all only-whitespace changes. But if there are files which only differ on whitespace, git-diff produces an empty patch block (what's the correct name for it?) like

     diff --git a/hello b/hello
     index f2aa86d..ce01362 100644

which git-apply refuses to apply. Is this behaviour of git-diff intentional or should I try to cook up a patch?

Another combination which does not for for me is --interactive and --whitespace for rebase:

     > git rebase -i --whitespace=strip HEAD^
     fatal: Needed a single revision
     Invalid base

Is this an implementation bug or lack of a note of incompatibility in the docs?

Message 1 of 1 in “Ignoring whitespace for diff and rebase”
  1. Lars NoschinskiAug 15, 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.