Note: in thinking about this and looking over the git flow description again, I think I'm actually doing git flow wrong (making feature branches off of master instead of dev). Doesn't change my question, but before everyone starts jumping in to point out that I'm doing it wrong ;)
I am following something akin to git flow, where I have code in a foo-release
branch off of master that I want to merge into my foo-dev
branch off of a dedicated (and shared with other developers) dev branch used for testing.
I can't just git merge foo-release
into my foo-dev because master has a bunch of unrelated commits that aren't in dev (I think this shouldn't be the case according to git flow, but for now it is), and those other commits would come with it if I tried to create a github PR after that (see here)
I thought I'd found the answer in git cherry-pick main...foo-release
, which just takes the commits native to my release branch and applies them to my dev branch.
But then say I merge my foo-dev into dev, deploy, find a problem, and then fix it in foo-release (in git flow you make all code changes in the release branch).
Now when I run git cherry-pick main...foo-release
, some commits have already been applied, so in cherry-pick they are empty patches so it stops to complain about each one. If I run git cherry-pick --continue
for each of those it seems to work ok, but that's really annoying.
What I want is something that cherry-picks a range, auto-skipping empties, and --allow-empty
and --keep-redundant-commits
don't seem to be it. Is there any way to do this?