commit-and-push-jp

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit And Push (JP)

Commit And Push (JP)

Purpose

用途

  • Turn pending work into a single Japanese commit (see commit-jp), then push it to
    origin
    on the same branch.
  • Run
    pnpm lint && pnpm test
    before pushing (unless the repo documents different checks).
  • If push fails for sync reasons, coordinate with pull, then push again—same as push.
  • 将未提交的工作转换为单个日语提交(参考commit-jp规范),然后推送到当前分支的
    origin
    远程仓库。
  • 推送前运行**
    pnpm lint && pnpm test
    **(除非仓库文档指定了其他检查流程)。
  • 如果因同步问题推送失败,配合pull操作进行合并,然后重新推送——与push规范一致。

Prerequisites

前提条件

  • Same as commit-jp (working tree, diffs, AGENTS.md rules) and push (
    origin
    , credentials).
  • Uncommitted changes exist, or the user explicitly wants to commit remaining work—if there is nothing to commit, stop after reporting that.
  • 满足commit-jp的要求(工作树、变更差异、AGENTS.md规则)以及push的要求(
    origin
    远程仓库、凭证)。
  • 存在未提交的变更,或者用户明确要求提交剩余工作——如果没有内容可提交,告知用户后停止操作。

When to Use

使用场景

  • "commit して push", "コミットしてリモートへ", "まとめて出して", or similar—when the user wants both a commit and a remote update in one flow.
  • 当用户提出类似「commit して push」「コミットしてリモートへ」「まとめて出して」的需求时——即用户希望在一个流程中同时完成提交和远程仓库更新。

Do Not Use When

禁用场景

  • Only a commit is needed (use commit-jp).
  • Only push is needed—e.g. commits already exist (use push).
  • Only syncing with the base branch is needed (use pull).
  • A PR should be created or updated (use create-pr-jp after push, or as documented).
  • 仅需要提交操作时(使用commit-jp)。
  • 仅需要推送操作时——例如已经存在提交记录(使用push)。
  • 仅需要与基准分支同步时(使用pull)。
  • 需要创建或更新PR时(推送后使用create-pr-jp,或按照文档操作)。

Related Skills

相关技能

  • commit-jp: Staging, Japanese Conventional Commit message,
    git commit -F
    , trailers.
  • push: Pre-push
    pnpm lint && pnpm test
    ,
    git push
    /
    -u origin
    , handling non-fast-forward with pull.
  • pull: When
    git push
    is rejected or the branch is behind / conflicted.
  • create-pr-jp: PR open/update—not part of this skill.
  • commit-jp:暂存变更、日语Conventional Commit提交信息、
    git commit -F
    命令、提交尾部信息(trailers)。
  • push:推送前的
    pnpm lint && pnpm test
    检查、
    git push
    /
    -u origin
    命令、使用pull处理非快进式推送失败。
  • pull:当
    git push
    被拒绝或分支落后于远程/存在冲突时使用。
  • create-pr-jp:创建或更新PR——不属于本技能范畴。

Procedure

操作流程

  1. Preflight:
    git status --short --branch
    . If there is nothing to commit, report that and do not push.
  2. Commit (commit-jp) — follow commit-jp completely:
    • Session +
      git status
      /
      git diff
      /
      git diff --staged
      ; stage intended paths (
      git add
      as appropriate).
    • Japanese subject + body (概要 / 理由 / テスト),
      git commit -F <file>
      , Conventional Commits type, Codex trailer if applicable.
    • Do not use
      git commit -m
      for multi-line bodies; avoid junk files in the commit.
  3. Pre-push checks:
    pnpm lint && pnpm test
    (or repo-standard scripts per AGENTS.md).
  4. Push — same rules as push:
    • git push
      when upstream exists; otherwise
      git push -u origin HEAD
      (or
      git push --set-upstream origin <branch>
      ).
  5. If push fails (non-fast-forward / behind): use pull to merge the base per repo policy, resolve conflicts, re-run
    pnpm lint && pnpm test
    , then push again. Use
    --force-with-lease
    only after intentional history rewrite—never plain
    --force
    .
  6. If push fails for auth / permissions: show the error; do not change remotes or protocols to “fix” it.
  1. 预检:执行
    git status --short --branch
    。如果没有内容可提交,告知用户并停止推送
  2. 提交(遵循commit-jp规范)——完全按照commit-jp的要求执行:
    • 查看会话记录 +
      git status
      /
      git diff
      /
      git diff --staged
      ;暂存目标路径(按需执行
      git add
      )。
    • 编写日语主题+正文(概要 / 理由 / テスト),使用
      git commit -F <file>
      命令,遵循Conventional Commits类型规范,如需添加Codex尾部信息则补充。
    • 多行提交信息不要使用
      git commit -m
      命令;避免将无用文件纳入提交。
  3. 推送前检查:执行
    pnpm lint && pnpm test
    (或按照AGENTS.md中指定的仓库标准脚本执行)。
  4. 推送——遵循push的规则:
    • 如果已设置上游分支,执行
      git push
      ;否则执行
      git push -u origin HEAD
      (或
      git push --set-upstream origin <branch>
      )。
  5. 如果推送失败(非快进式/分支落后):使用pull操作按照仓库策略合并基准分支,解决冲突,重新执行**
    pnpm lint && pnpm test
    ,然后再次推送。仅在有意重写提交历史且符合仓库策略时使用
    --force-with-lease
    **——绝对禁止使用普通的
    --force
  6. 如果因认证/权限问题推送失败:展示错误信息;不要修改远程仓库地址或协议来“修复”问题。

Output

输出结果

  • One new commit on the current branch (per commit-jp).
  • Successful push to
    origin
    for that branch (upstream set on first push if needed).
  • 当前分支新增一个符合commit-jp规范的提交
  • 该分支成功推送到
    origin
    远程仓库(首次推送时会自动设置上游分支)。

Usage

使用示例

Illustrative sequence (adapt branch and scripts):
sh
git status --short --branch
示例操作序列(可根据分支和脚本调整):
sh
git status --short --branch

--- commit-jp: inspect, stage, write message file, then ---

--- 执行commit-jp:检查、暂存、编写提交信息文件,然后执行 ---

git commit -F /tmp/COMMIT_MSG.txt
git commit -F /tmp/COMMIT_MSG.txt

--- pre-push (align with push skill) ---

--- 推送前检查(与push技能保持一致) ---

pnpm lint && pnpm test
pnpm lint && pnpm test

--- push ---

--- 推送 ---

git push 2>/dev/null || git push -u origin HEAD
git push 2>/dev/null || git push -u origin HEAD

If rejected: pull skill → resolve → pnpm lint && pnpm test → git push again

如果被拒绝:执行pull技能 → 解决冲突 → pnpm lint && pnpm test → 再次执行git push

undefined
undefined

Present Results to User

向用户展示结果

  • List commands run and pass/fail for commit, lint, test, and push.
  • Confirm branch name and that the tip is on
    origin
    after success.
  • Do not claim a PR was created or updated—that is create-pr-jp.
  • 列出执行的命令以及提交、lint检查、测试、推送的成功/失败状态。
  • 确认分支名称,并在操作成功后告知用户分支最新提交已同步到
    origin
  • 绝对不要声称已创建或更新PR——此操作属于create-pr-jp

Notes

注意事项

  • Do not run
    git reset --hard
    or
    git push --force
    to recover (except
    --force-with-lease
    when history rewrite is intentional and policy allows—same as push).
  • If commit fails, do not proceed to push until the commit step succeeds.
  • If lint/test fails after a successful commit, do not push; fix or amend per repo practice, then re-run checks and push.
  • 不要使用
    git reset --hard
    git push --force
    来恢复操作(除非是有意重写提交历史且符合仓库策略时使用**
    --force-with-lease
    ——与push**规范一致)。
  • 如果提交失败,在提交步骤成功前不要进行推送操作。
  • 如果提交成功后lint/测试失败,不要推送;按照仓库实践修复或修改提交,然后重新执行检查并推送。

Troubleshooting

故障排除

SituationAction
Nothing to commitReport and stop; use push if only publishing existing commits
Commit message / staging wrongFix with commit-jp rules before pushing
Lint/test fails after commitDo not push; fix, amend or follow-up commit, re-run
pnpm lint && pnpm test
non-fast-forward
on push
pull → merge base →
pnpm lint && pnpm test
→ push again
Auth / permission deniedReport verbatim; user fixes credentials or access
场景操作
无内容可提交告知用户后停止操作;如果仅需发布已有的提交记录,使用push
提交信息/暂存内容错误按照commit-jp规则修复后再推送
提交后lint/测试失败不要推送;修复问题、修改提交或补充提交后,重新执行
pnpm lint && pnpm test
推送时提示
non-fast-forward
执行pull → 合并基准分支 →
pnpm lint && pnpm test
→ 再次推送
认证/权限被拒绝原样展示错误信息;由用户修复凭证或权限问题