openstack-manuals/doc/contributor-guide/source/additional-git-workflow/cherry-pick.rst
Olena Logvinova 808ac7e64f [Contrib Guide] Backport section to RST & final edits
This patch:
- translates the below wiki page to RST:
  https://wiki.openstack.org/wiki/Documentation/HowTo#Git_commit_messages_and_backports
- creates a new folder called Additional Git workflow and moves the file
  cherry-pick.rst to this folder;
- replaces '_' with '-' in some file names for consistency;
- changes the files order in the index.html file;
- updates text for the Abstract section in Introduction.

Change-Id: Icd66e1af93a12f1c3fc827ce228001dced9aa065
Implements: blueprint docs-contributor-guide
2015-10-22 17:15:02 +03:00

2.0 KiB

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