If I have a local branch in git with commits A, B, C, D, E and I choose to delete it using
git branch -D myBranch
but I save the commit IDs before deleting, will I be able to cherry-pick some of these commits to another branch by their IDs afterwards?
Yes. Just specify the commit ids (SHAs) in the cherry-pick command:
git cherry-pick -x <commit-hash>
-x is not required, but recommended as it will give you a standard comment.)
This answer has more details.