commit-message

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit Message Skill

Commit Message Skill

This skill creates a git commit with the required format. Follow these steps:
该Skill会按照要求的格式创建git提交。请遵循以下步骤:

1. Branch Safety Check (for bucketplace repos)

1. 分支安全检查(适用于bucketplace仓库)

First, check if this is a bucketplace organization repo:
bash
git remote get-url origin 2>/dev/null | grep -q 'bucketplace' && echo "bucketplace" || echo "other"
If bucketplace repo, check the current branch:
bash
git branch --show-current
If on a protected branch (
main
,
master
,
develop
):
  • If a Jira ticket exists in the context (e.g., COREPL-1234):
    1. Check if branch already exists:
      git branch --list <TICKET-ID>
    2. If exists, add a suffix (e.g.,
      COREPL-1234-2
      ,
      COREPL-1234-refactor
      )
    3. Create the branch:
      git checkout -b <branch-name>
    4. Proceed with the commit on this new branch
  • If no Jira ticket:
    1. Generate a descriptive branch name based on the changes (e.g.,
      fix/login-validation
      ,
      feat/add-cache-layer
      )
    2. Create the branch and proceed with the commit
首先,检查当前仓库是否属于bucketplace组织:
bash
git remote get-url origin 2>/dev/null | grep -q 'bucketplace' && echo "bucketplace" || echo "other"
如果是bucketplace仓库,检查当前分支:
bash
git branch --show-current
如果当前处于受保护分支(
main
master
develop
):
  • 如果上下文存在Jira工单(例如:COREPL-1234):
    1. 检查分支是否已存在:
      git branch --list <TICKET-ID>
    2. 如果已存在,添加后缀(例如:
      COREPL-1234-2
      COREPL-1234-refactor
    3. 创建分支:
      git checkout -b <branch-name>
    4. 在新分支上继续执行提交
  • 如果没有Jira工单
    1. 根据变更内容生成描述性分支名称(例如:
      fix/login-validation
      feat/add-cache-layer
    2. 创建分支并继续执行提交

2. Check staged changes

2. 检查暂存的变更

Run
git diff --cached
to see what will be committed. If nothing is staged, run
git status
and add relevant files individually (NEVER use
git add -A
or
git add -u
).
执行
git diff --cached
查看将被提交的内容。 如果没有暂存任何内容,执行
git status
并单独添加相关文件(禁止使用
git add -A
git add -u
)。

2. Generate commit message

2. 生成提交信息

Based on the staged changes, create a commit message:
  • First line: conventional commit format (feat:, fix:, docs:, etc.) under 72 chars in English
  • Empty line
  • Body: wrapped at 72 chars, explaining what and why in Korean
根据暂存的变更,创建提交信息:
  • 第一行:符合Conventional Commit格式(feat:、fix:、docs:等),英文,长度不超过72字符
  • 空行
  • 正文:每行不超过72字符,用韩语说明变更内容和原因

3. Execute the commit

3. 执行提交

Use heredoc syntax for the commit:
bash
git commit -m "$(cat <<'EOF'
<type>: <subject in English>

<body in Korean, wrapped at 72 chars>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
使用heredoc语法执行提交:
bash
git commit -m "$(cat <<'EOF'
<type>: <subject in English>

<body in Korean, wrapped at 72 chars>

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"

4. Verify

4. 验证

Run
git status
to confirm the commit was created successfully.
执行
git status
确认提交已成功创建。