Cherry pick a change

Cherry pick a change

If a docfix was submitted to the master openstack-manuals branch and you want to reflect this change, for example, in the Kilo documentation, which is closed, you can cherry pick the change and submit it.

Use the Cherry Pick To button in Gerrit Web UI from the original master review page. If the Cherry Pick To button does not work, it means that there are conflicts and you need to cherry pick the patch manually.

For example, you want to cherry pick bug/1506693 (review 235734) into Kilo:

  1. Wait for the change to be merged into the master branch.

  2. Make sure your repository is up to date:

    $ git fetch origin
    
  3. Create a topic branch by branching from Kilo:

    $ git checkout -b kilo-bug/1506693 remotes/origin/stable/kilo
    
  4. On the Gerrit web page that contains the review you want to backport, click cherry-pick. It is located under Patch Set N, in the Download row.

  5. Copy the text, then paste it into your terminal. For example, for review 235734, it looks like this:

    $ git fetch https://review.openstack.org/openstack/openstack-manuals \
      refs/changes/34/235734/1 && git cherry-pick -x FETCH_HEAD
    

    Note

    Use the -x option with the cherry-pick command to preserve git history metadata in the cherry pick commit message.

  6. Resolve conflicts if any, then run:

    $ git cherry-pick --continue
    
  7. Run tox, and then commit your change:

    $ git commit --amend
    
  8. Make sure you retain the original Change-Id from the previous commit message. This facilitates tracking of backports into all affected branches. You may add “Cherry-pick from review.openstack.org/URL” to the commit message to make it easier for reviewers. Push the commit for review:

    $ git review
    
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.