Skip to content

Instantly share code, notes, and snippets.

@allex
Forked from sivel/cherry-pick-pr.md
Created August 14, 2018 06:26
Show Gist options
  • Save allex/00eeec98ad070bafa5964dfdf0436598 to your computer and use it in GitHub Desktop.
Save allex/00eeec98ad070bafa5964dfdf0436598 to your computer and use it in GitHub Desktop.
Basic workflow for creating a cherry-pick pull request for ansible

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.

  1. 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]
    
  2. Add a changelog entry for the change, and commit it

  3. Push your branch to your fork:

    git push origin cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL]
    
  4. Submit PR for cherry-pick/2.5/[PR_NUMBER_FROM_DEVEL] against the stable-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment