git cherry-pick does not work

Viewed 13957

I get a strange error:

git cherry-pick a0cd8fe

fatal: bad revision 'a0cd8fe'

Why is that?

Note that the branch that a0cd8fe was merged to has been deleted. Is that why I get this error?

3 Answers

That is because you don't have the remote branch (from where you want to cherry-pick) locally

Solution

git fetch origin <remote_branch>
git cherry-pick <commit_id>

I just had the same exact problem.

I resolved it by typing git fetch before git cherry-pick xxxxxx

Related