After submitting a PR to Ansible for the devel
branch, and having it merged, the following instructions will help you create a pull request to backport the change to a previous stable branch
These instructions assume that stable-2.5
is the previous release branch.
-
Update devel, to ensure you have the commit to cherry pick:
git checkout devel git --fetch upstream git merge upstream/devel git checkout stable-2.5 git pull git checkout -b cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL] git cherry-pick -x [SHA_FROM_DEVEL]
-
Add a changelog entry for the change, and commit it
-
Push your branch to your fork:
git push origin cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL]
-
Submit PR for
cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL]
against thestable-2.5
branch
The choice to use cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL]
as the feature branch is somewhat arbitrary, but conveys meaning about the purpose of that branch. It is not required to use this format, but it can be helpful, especially when making multiple backport PRs for multiple stable branches.
This looks like a good start- only other "assumption" you might want to add is around the definitions of
origin
andupstream
, as those aren't always consistent (eg,origin
for me is alwaysansible/ansible
- I create multiple named remotes for the various forks I might push to).I usually do cherry-picks with a disconnected HEAD right off the remote branch instead of transiting through local branches, which gets rid of a couple of steps (and potential for "leaking" other changes in- more important for direct push, less so when using PRs), but this is probably more "idiomatic git" for the way most people do it.