Home > Enterprise >  After deletion of a local branch in git, will I be able to cherry-pick commits from the deleted bran
After deletion of a local branch in git, will I be able to cherry-pick commits from the deleted bran

Time:02-02

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?

CodePudding user response:

Yes. Just specify the commit ids (SHAs) in the cherry-pick command:

git cherry-pick -x <commit-hash>

(The -x is not required, but recommended as it will give you a standard comment.) This answer has more details.

  • Related