How can I resume rebase after "Unable to create '.git/index.lock': File exists."?
<p>I run Xcode, which runs <code>git</code> operations automatically. This can cause some <code>rebase -i</code> operations to fail, if Xcode starts the operation faster than <code>git</code> does. That results in:</p>

<pre><code>fatal: Unable to create '.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
</code></pre>

<p>The Xcode task completes before I can do anything, so <code>index.lock</code> is already gone and I should be ready to continue.</p>

<p>Okay, so I try <code>git rebase --continue</code>, since the other operation has finished by now, and <code>index.lock</code> should be gone. However, this quickly blows up, with an error message like:</p>

<pre><code>The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:

    git commit --allow-empty

Otherwise, please use 'git reset'
interactive rebase in progress; onto abcdef
Last commands done (X commands done):
   pick abcdef Something
   pick abcdef Something
Next commands to do (Y remaining commands):
   pick abcdef Something
   pick abcdef Something
You are currently rebasing branch 'foo' on 'abcdef'.

nothing to commit, working directory clean
Could not apply abcdef
</code></pre>

<p>At this point, I just give up, <code>--abort</code>, and start again. I lose the rebase strategy I made, and any conflicts that I resolved. What can I do to resume this process correctly, losing no data?</p>

<p>For the purposes of this question, "close Xcode before rebasing" isn't the answer I'm looking for. Assume that I've already forgotten to do that, and am in this broken state (also, Xcode takes forever to start up, and this only happens rarely).</p>