How to undelete a file previously deleted in git's history?

Solution 1:

git checkout <commit> <filename>

Solution 2:

I got it:

git tag originalHead # just in case
git rebase -i <id of the parent of the commit that deleted the file>
# change pick to edit for that commit
git checkout <id of the previous commit> <filename> # thanks for reminding, kubi
git commit --amend
git rebase --continue
git tag -d originalHead

edit unfortunately this will leave all tags at the old timeline, see here