title: git rebase, "would be overwritten", and "No changes - did you forget to use 'git add'?"
body: <p><code>git rebase</code> does not appear to work properly in certain cases where a file is added to the repository, then removed from the repository, then added to the working directory (but not the repository).</p>
  
  <p>Here's a more specific description of my problem:</p>
  
  <ul>
  <li><p>if a branch is created and switched to from some
  trunk,</p></li>
  <li><p>and a file X is added and committed
  in the branch,</p></li>
  <li><p>and subsequently X is removed and
  committed in the branch,</p></li>
  <li><p>and X is again created in the working
  directory, but not added or
  committed,</p></li>
  <li><p>and the trunk branch advances,</p></li>
  <li><p>then</p></li>
  <li><p>a rebase performed using the advanced
  trunk as the base will fail because
  it will refuse to overwrite X,</p></li>
  <li><p>and the rebase cannot be continued
  even if the working directory X is
  removed or moved out of the way.</p></li>
  </ul>
  
  <p>Here's a script to reproduce my problem on the command line:</p>
  
  <pre><code>git init
  echo foo &gt; foo.txt
  git add .
  git commit -m 'foo'
  echo foo &gt;&gt; foo.txt
  git add .
  git commit -m 'foo foo'
  git checkout -b topic HEAD^
  git log
  echo bar &gt; bar.txt
  echo baz &gt; baz.txt
  git add .
  git commit -m 'bar baz'
  git rm bar.txt
  git commit -m '-bar' 
  echo bar &gt; bar.txt
  git rebase master 
  # the following output is emitted:
  # First, rewinding head to replay your work on top of it...
  # Applying: bar baz
  # Using index info to reconstruct a base tree...
  # Falling back to patching base and 3-way merge...
  # error: Untracked working tree file 'bar.txt' would be overwritten by merge.  Aborting
  # Failed to merge in the changes.
  # Patch failed at 0001 bar baz
  # 
  # When you have resolved this problem run "git rebase --continue".
  rm bar.txt
  git rebase --continue
  # the following output is emitted:
  # Applying: bar baz
  # No changes - did you forget to use 'git add'?
  # 
  # When you have resolved this problem run "git rebase --continue".
  # If you would prefer to skip this patch, instead run "git rebase --skip".
  # To restore the original branch and stop rebasing run "git rebase --abort".
  </code></pre>
  
  <p>I know I can abort the rebase using <code>git rebase --abort</code>, remove <code>bar.txt</code>, and then <code>git rebase master</code> again.  But how can I continue the rebase without aborting it first?</p>