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

Cannot rewrite branch(es) with a dirty working directory

From
James Blackburn <jamesblackburn@gmail.com>
Date
Sep 1, 2011, 15:52 UTC
Message-ID
<CACyv8dfL-G0Px0aFe3VFNHP-1xRUDLsFxgUu3amPGzO7qKp7jQ@mail.gmail.com>
Hi All,

I get a spurious: "Cannot rewrite branch(es) with a dirty working directory." trying to filter-branch in a clean git repo (having done a reset). The error disappears when I do git status.

Log of the shell commands: bash:jamesb:xl-cbga-20:33083> mkdir org.eclipse.cdt.core.linux.ia64 bash:jamesb:xl-cbga-20:33084> cp -r ../../../CDT_HEAD_GIT/org.eclipse.cdt/.git org.eclipse.cdt.core.linux.ia64/ bash:jamesb:xl-cbga-20:33085> cd org.eclipse.cdt.core.linux.ia64/ mbash:jamesb:xl-cbga-20:33086> git reset --hard Checking out files: 100% (11879/11879), done. HEAD is now at a03d454 Build against a local mirror of the 3.7 p2 repo bash:jamesb:xl-cbga-20:33087> git filter-branch --subdirectory-filter core/org.eclipse.cdt.core.linux.ia64 -- master Cannot rewrite branch(es) with a dirty working directory. bash:jamesb:xl-cbga-20:33088> git status # On branch master nothing to commit (working directory clean) bash:jamesb:xl-cbga-20:33089> git filter-branch --subdirectory-filter core/org.eclipse.cdt.core.linux.ia64 -- master Rewrite d7092b12c93925f6f7c4725a5abc72e55650621c (16/16) Ref 'refs/heads/master' was rewritten bash:jamesb:xl-cbga-20:33090> git --version git version 1.7.3.2

Is there a particular reason why filter-branch thinks the tree is dirty, and status magically fixes this?

Cheers, James

Next: Matthieu Moy
Message 1 of 5 in “Cannot rewrite branch(es) with a dirty working directory”
  1. James BlackburnSep 1, 2011
  2. Matthieu MoySep 1, 2011
  3. Jeff KingSep 1, 2011
  4. Jeff KingSep 1, 2011
  5. Matthieu MoySep 2, 2011

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.