(It's the first time I'm trying to use git's cherry picking, so maybe I misunderstood what it is or what it can do)
While working on some new feature in a feature branch (for simplicity let's call it just next
), I discovered some bugs in the current master
that I fixed "on the fly" (which may not have been the best idea). Now that I think the feature branch is complete, I'd like to cherry pick some or all of the bugs fixed in next
to master
to make a bug-fix release before a feature release.
So I checked out master
and tried (after reading the git-cherry manual page):
git cherry
git cherry next
git cherry -v next
git cherry -v next master
However none of the commands did output anything, even though there is a huge difference between next
and master
.
So what is the problem? Did I do something wrong, or did I misunderstand about cherry picking? The manual refers to some "origin" branch, while my branch is local.
If the cherry picking is the wrong tool, what would be the correct procedure to achieve what I'm trying to do?
git cherry
and git cherry-pick
are two different commands.
From source git cherry:
git cherry [-v] [<upstream> [<head> [<limit>]]]
will show you a ID's of commits which are missing from head
on upstream
. In your case git cherry next master
didn't show anything cause there are no commits on master
, which are not present on next
branch. You can check the other way git cherry master next
and you will see all next
commits ID's, which are not present on master
.
Once you will know id's of commits, which you want to cherry pick do this with git cherry-pick commitID