commit
暂存、提交更改并将更改推送到当前分支。当要求提交更改、推送代码或完成任务后使用。
📖 中文导读:暂存、提交更改并将更改推送到当前分支。当要求提交更改、推送代码或完成任务后使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: commit description: Stage, commit, and push changes to the current branch. Use when asked to commit changes, push code, or after completing a task. allowed-tools: Bash
Commit and Push
Stage all changes, create a commit with a conventional commit message, and push to the remote.
Instructions
- Run
git statusto see what files have changed - Run
git diffto understand the changes (both staged and unstaged) - Run
git log --oneline -5to see recent commit message style - Stage relevant files with
git add - Create a commit with a descriptive message following conventional commits format
- Push to the current branch
Important: Git Identity
Do NOT modify the git author or add Co-Authored-By headers. The commit should use the user's existing git configuration (their name and email from git config user.name and git config user.email).
Commit Message Format
Use conventional commits style observed in the repository:
feat:for new featuresfix:for bug fixeschore:for maintenance tasksrefactor:for code refactoringdocs:for documentation changes
Keep subject line under 72 characters. Focus on the "why" rather than the "what".
Commit Command Format
Always use a HEREDOC to ensure proper formatting:
git commit -m "$(cat <<'EOF'
<type>: <description>
<optional body explaining why>
EOF
)"
Safety Rules
- NEVER commit files that contain secrets (.env, credentials.json, etc.)
- NEVER use
--forceor--no-verifyunless explicitly requested - NEVER amend commits that have been pushed to remote
- NEVER modify git config (user.name, user.email, etc.)
- If pre-commit hooks fail, fix the issues and create a NEW commit
Push
After committing, push to the current branch:
git push origin HEAD
If the branch doesn't have an upstream, use:
git push -u origin HEAD