As a preface, I want to say that git-flow
will solve some of these problems. I would prefer to stick to using GitHub PRs to handle both feature and hotfix branches. I also prefer to rebase feature branches. I follow the mantra that every commit should have a full set of passing tests. If you merge a commit upstream, you cannot guarantee that all commits will have passing tests without re-running the tests on every commit.
I have branches PROD and DEV. PROD should always be upstream from DEV. If I have a fix that needs to go to PROD, here's what I would do:
- branch off of PROD and create a fix -> commit X
- merge X into PROD and release a new tag with
git tag ...
(merge with GitHub PR so that the fix can be reviewed) - branch off of DEV && git cherry-pick X then PR to DEV (no need to release a new tag here)
Now the problem arises with the last step. What if I forget the last step? How can I check to see if X' (the cherry-picked commit) is on DEV? What's the best way to keep PROD and Dev up-to-date, or at least see if they differ with cherry-picks?
I've played around with git log --cherry-pick DEV..PROD, but commit X is still showing up.
This article provides a couple good options but I'm trying to solve the scenario where I have to cherry-pick instead of maintaining another branch.