title: Why can a directory be removed when my shell is using that directory?
body: <p>I don't know if what I encountered was a bug or is intended behavior, but luckily I figured out pretty quick what was going on. </p>
  
  <p>I had my shell cd'd inside a subdirectory of the git repo, and I performed a <code>git rebase -i</code> squash operation in which the commits involved included the creation of this directory.</p>
  
  <p>After that operation completed without incident, the shell became in an orphaned state where the <code>git status</code> (neither in the zsh theme helper RPROMPT nor when run) indicated that I wasn't even in a git repository anymore. </p>
  
  <p>Once I ran <code>cd ..</code> everything was fine, and it all made sense. During the course of the rebasing operation, Git had <code>rm</code>'d the directory that I was in (at the first step of the rebase) and subsequently put it back. Since it got put back, I could also have ran <code>cd $(pwd)</code> to go there in one step. </p>
  
  <p>This is some confusing behavior. Although, it is not clear that anything was technically done wrong by git. My question is would this be a bug in <code>git</code> or should users be expected to know how to deal with this situation?</p>
  
  <p>Also, the wider, actual root question: Why is it permitted to remove a directory that my shell is in, when it is not permitted to eject a disk if I have a shell on a mounted directory? It seems inconsistent to me.</p>
  
  <p>Case in point: <code>fuser &lt;directory&gt;</code> shows current directory uses. If a program is "on" a directory it is "using" it. </p>