WordPress/gutenberg

Improve the manual `git cherry-pick` instructions left when performing an automatic cherry-pick fails

Open

#76576 opened on Mar 17, 2026

View on GitHub
 (1 comment) (0 reactions) (1 assignee)JavaScript (9,607 stars) (3,893 forks)batch import
Good First Issue[Status] In Progress[Type] Build Tooling[Type] Enhancement

Description

What problem does this address?

When the Auto Cherry-Pick GitHub Actions workflow fails, the following comment is left on the PR:

# Checkout the wp/7.0 branch instead of trunk.
git checkout wp/7.0

# Create a new branch for your PR.
git checkout -b my-branch

# Cherry-pick the commit.
git cherry-pick d738de8b5ccd5cfc0dceee7e7c232738ebade15c

# Check which files have conflicts.
git status

# Resolve the conflict...
# Add the resolved files to the staging area.
git status
git add .
git cherry-pick --continue

# Push the branch to the repository
git push origin my-branch

# Create a PR and set the base to the wp/7.0 branch.
# See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request.

These are great but there are a few things that can be improved.

What is your proposed solution?

  1. Instead of my-branch, the instructions should include a contextual branch name. Above, a cherry-pick of d738de8b5ccd5cfc0dceee7e7c232738ebade15c is being attempted. The branch could should be some combination of commit SHA value, PR number, and target branch. Some possible values:
    • wp/7.0/cherry-pick/d738de8b5ccd5cfc0dceee7e7c232738ebade15c-from-76398
    • cherry-pick/d738de8-to-wp-7.0-from-76398 (shortened hash)
    • cherry-pick/76398-to-wp-7.0
    • etc.
  2. It should be noted that the conflict resolution step is optional/only if necessary.
  3. It's not clear if someone should perform this on their fork or the main repository. I think either is probably fine, but noting that could help someone without write access to this repo know they are free to create a PR performing the cherry-pick if they would like to.
  4. The link included in the last step (Create a PR and set the base to the wp/X.Y branch) is helpful, but the link is not clickable. That last step should be removed from the code block and placed after.
  5. Setting the correct BASE branch of a PR is easy to forget. I think it could be helpful to include the command to accomplish that using GitHub CLI: gh pr create --base wp/7.0 --web. This will open the web UI with the correct HEAD and BASE branches set so the person can enter the details for the pull request. Alternatively, gh pr create --title="Cherry-pick d738de8towp/7.0" --body="Auto-generated description here" (I don't believe that --web can be combined with --title and --body).

Contributor guide