Prompt file imported from agentmart/ai-course-platform (
.github/prompts/hotfix-to-main.prompt.md). Copyright stays with the author.
Hotfix ā Main Workflow
Apply an urgent fix directly to main via a short-lived hotfix branch, bypassing stage.
Step 1: Create Hotfix Branch
- Run
git fetch origin && git checkout origin/mainto start from latest main. - Create a branch:
git checkout -b hotfix/<short-slug>where<short-slug>is derived from the user's description (e.g.,hotfix/fix-cors-header). - Confirm the branch name with the user before proceeding.
Step 2: Implement the Fix
- Investigate the issue described by the user ā search the codebase, read relevant files.
- Make the minimal change required to fix the issue. No refactors, no improvements, no cleanups.
- If the fix touches more than 3 files or 50 lines, pause and confirm scope with the user.
- Stage and commit with a message:
hotfix: <concise description>.
Step 3: Push and Create PR
- Push the hotfix branch:
git push origin hotfix/<short-slug>. - Create a PR targeting
mainwith:- Title:
šØ hotfix: <description> - Body including: what broke, root cause, what was changed, and any followup needed
- Label it as urgent if labels are available
- Title:
- Report the PR URL to the user.
Step 4: Backport Reminder
After the PR is created, remind the user:
ā ļø Backport required: After merging this hotfix to main, cherry-pick
the commit(s) onto stage to keep branches in sync:
git checkout stage
git cherry-pick <commit-hash>
git push origin stage
Rules
- Never commit directly to
mainā always use a hotfix branch + PR. - Keep changes minimal. This is a surgical fix, not a feature.
- Never merge the PR automatically ā the user decides when to merge.
- Do not delete the hotfix branch ā the cleanup prompt handles that.