Accidentally deleted files during git rebase. Can I redo it?
<p>I did <code>git rebase origin/master</code> on my project to get on track with upstream. </p>

<p>I deleted some files during the conflict resolution (not in the last commit) as I thought I won't need them in my branch. But I do need them. </p>

<p>I could checkout the upstream elsewhere copy those files to my repo and create a commit saying "sorry" but that's just not nice. I'd much rather "undo" the deletion. </p>

<p>I tried running <code>git rebase -i &lt;parent of the deleting commit&gt;</code> according to <a href="https://stackoverflow.com/a/180085/336753">this answer</a> and mark the deleting commit with <code>e</code> for edit. But I don't see any files staged. <strike>All I can do is amend the commit and that only allows me to edit the commit message, from what I know. </strike></p>

<p>So how do I undo the deletion in my past commit? </p>

<hr>

<p>For simplicity and completeness I'll add the set of commands I used: </p>

<pre><code>git rebase -i &lt;parent_of_the_wrong_commit&gt;
# mark e next to the deleting commit and copy its hash
git reset HEAD^
git checkout -- the/accidentally/deleted/directory
git add .
git commit -c &lt;the_copied_hash&gt;
git rebase --continue
</code></pre>