User login

Harmless Git weirdness: git rm -r does not delete physical files, but doesn't list them as untracked either

Somehow, in git 1.6, after running git rm -r example to get rid of a directory (called example), it leaves the files there but from then on ignores them. git status lists nothing, ls shows the directory example is still there, and then rm -rf example removes the directory and git status still shows nothing. Not sure how long this effect will last but if you, like me, trust git to let you know what is tracked or untracked – what is there – with the exception of things explicitly put into the .gitignore file, then you will want to run git rm -r example; rm -rf example as one command or immediately after one another, simply to keep matters neat and clean, and not introduce git ghosts.

If you have an empty folder (or a whole nested set of empty folders!) that git just doesn't seem to know about, whether you remove folders or add them back, your problem is likely that the directory and all in it was git rm'd (by you or someone you pulled from).

Git does not remove folders from your working copy when it removes them from the repository. So when you git pull, all the files in the folder are deleted, but the folders are still there. Which, incidentally, is lame.

Searched words: 
git ghost folders directories git status doesn't show after git rm but files are there not removed from file system index oddness


Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.