I did git rebase origin/master
on my project to get on track with upstream.
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.
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.
I tried running git rebase -i <parent of the deleting commit>
according to this answer and mark the deleting commit with e
for edit. But I don't see any files staged. All I can do is amend the commit and that only allows me to edit the commit message, from what I know.
So how do I undo the deletion in my past commit?
For simplicity and completeness I'll add the set of commands I used:
git rebase -i <parent_of_the_wrong_commit>
# 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 <the_copied_hash>
git rebase --continue