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

Re: Deleted folder keeps showing up?

From
Jeff King <peff@peff.net>
Date
Sep 4, 2009, 08:27 UTC
Message-ID
<20090904082708.GA17157@coredump.intra.peff.net>
In-Reply-To
<34230C98-81B8-4DC8-846F-8B6FA2A022DA@gmx.de>
On Thu, Sep 03, 2009 at 06:59:18PM +0200, Benjamin Buch wrote:
Show 6 quoted lines
> I made a branch and deleted a folder there with git rm -rf foldername.
> So now i have to branches, A with the folder and B without the folder.
> 
> I'm on B, the folder is not there.
> Then I check out A, the folder shows up like it should.
> When I check out B again, the folder is still there.

Is there anything in the folder, like untracked files generated by your build process? Remember that git tracks full paths, not directories. So you never actually "deleted a folder" but rather deleted all of the paths inside that folder.

When you switch to branch A, git creates the folder, because it contains tracked files. When you switch back to branch B, git will remove the tracked files, and will remove the directory _only_ if it is then empty. Anything else would mean deleting your untracked files, which may be precious.

You mentioned in a later email that you were having trouble reproducing the issue. Try:

  $ git checkout A
  $ make ;# or whatever your build process is, or
         ;# normal work or whatever
  $ git checkout B
and see if that reproduces it.
-Peff
Previous: Benjamin Buch
Message 6 of 6 in “Deleted folder keeps showing up?”
  1. Benjamin BuchSep 3, 2009
  2. Michael J GruberSep 4, 2009
  3. Benjamin BuchSep 4, 2009
  4. Junio C HamanoSep 4, 2009
  5. Benjamin BuchSep 7, 2009
  6. Jeff KingSep 4, 2009

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.