AgentSkillsCN

commit

暂存、提交、创建 PR 并合并至主分支。适用于标准的提交—PR—合并流程。

SKILL.md
--- frontmatter
name: commit
description: Stage, commit, create PR, and merge to main. Use for the standard commit-PR-merge cycle.
workflow_stage: deployment
compatibility:
  - codex
  - claude-code
version: 1.0.0
tags:
  - git
  - commit
  - pr
  - merge

Commit, PR, and Merge

Stage changes, commit with a descriptive message, create a PR, and merge to main.

Steps

  1. Check current state:
bash
git status
git diff --stat
git log --oneline -5

Staleness check: If a root Makefile exists, run make -n to check for stale targets. If stale targets exist, warn the user before proceeding (soft gate -- warn, don't block).

  1. Create a branch from the current state:
bash
git checkout -b <short-descriptive-branch-name>
  1. Stage files -- add specific files (never use git add -A):
bash
git add <file1> <file2> ...

Do NOT stage .claude/settings.local.json, .codex/ local state, or any files containing secrets.

  1. Commit with a descriptive message:

If an argument is provided, use it as the commit message. Otherwise, analyze the staged changes and write a message that explains why, not just what.

bash
git commit -m "<commit message>"
  1. Push and create PR:
bash
git push -u origin <branch-name>
gh pr create --title "<short title>" --body "<summary and test plan>"
  1. Merge and clean up:
bash
gh pr merge <pr-number> --merge --delete-branch
git checkout main
git pull
  1. Report the PR URL and what was merged.

Important

  • Always create a NEW branch -- never commit directly to main
  • Exclude sensitive files from staging
  • Use --merge (not --squash or --rebase) unless asked otherwise
  • If a commit message argument is provided, use it exactly