Reputation: 2482
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?
Upvotes: 7
Views: 27488
Reputation: 392
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>
Upvotes: 8
Reputation: 1116
I just had the same exact problem.
I resolved it by typing git fetch
before git cherry-pick xxxxxx
Upvotes: 2
Reputation: 83527
Just deleting a branch does not remove any commits. Immediately afterwards, any git command will work when given the SHA hash of a commit that was on the deleted branch. These so-called orphaned commits are eventually garbage collected after a set amount of time. From your output, it assists that this is what has happened. After garbage collection, the commit is permanently deleted.
Upvotes: 4