Hotfix preview

From Kevin-Liu-01/Agent-Machines · View interactive version

Hotfix preview is an AI agent skill from the GitHub repository Kevin-Liu-01/Agent-Machines. Cherry-pick a commit from dev onto preview without a PR. Use when you need to cherry-pick a fix to preview without a PR, or for urgent fixes that can't wait for a full promote cycle.

How to use this skill

Skill file

When to use

A fix is on dev and needs to reach preview (and then prod) immediately.

The full /promote flow creates a changelog PR that needs review and merge.

This skill skips the PR and cherry-picks directly.

Rules

Both branches contain the same diff; history diverges by one merge-base commit.

This is fine — /promote reconciles them on the next full promotion.

Task

set -euo pipefail

REMOTE="${REMOTE:-upstream}"
SHA="${1:-$(git rev-parse "$REMOTE/dev")}"

# Validate the commit exists on dev
if ! git merge-base --is-ancestor "$SHA" "$REMOTE/dev"; then
  echo "error: $SHA is not on $REMOTE/dev" >&2
  exit 1
fi

# Cherry-pick onto preview
git fetch "$REMOTE" preview
git switch preview
git pull --ff-only "$REMOTE" preview
git cherry-pick "$SHA"
git push "$REMOTE" preview

# Show result
echo ""
echo "Cherry-picked $(git rev-parse --short "$SHA") onto preview as $(git log -1 --format='%h') — $(git log -1 --format='%s')"
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.