commit-and-push-jp
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCommit And Push (JP)
Commit And Push (JP)
Purpose
用途
- Turn pending work into a single Japanese commit (see commit-jp), then push it to on the same branch.
origin - Run before pushing (unless the repo documents different checks).
pnpm lint && pnpm test - 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 (, credentials).
origin - 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, , trailers.
git commit -F - push: Pre-push ,
pnpm lint && pnpm test/git push, handling non-fast-forward with pull.-u origin - pull: When is rejected or the branch is behind / conflicted.
git push - create-pr-jp: PR open/update—not part of this skill.
- commit-jp:暂存变更、日语Conventional Commit提交信息、命令、提交尾部信息(trailers)。
git commit -F - push:推送前的检查、
pnpm lint && pnpm test/git push命令、使用pull处理非快进式推送失败。-u origin - pull:当被拒绝或分支落后于远程/存在冲突时使用。
git push - create-pr-jp:创建或更新PR——不属于本技能范畴。
Procedure
操作流程
- Preflight: . If there is nothing to commit, report that and do not push.
git status --short --branch - Commit (commit-jp) — follow commit-jp completely:
- Session + /
git status/git diff; stage intended paths (git diff --stagedas appropriate).git add - Japanese subject + body (概要 / 理由 / テスト), , Conventional Commits type, Codex trailer if applicable.
git commit -F <file> - Do not use for multi-line bodies; avoid junk files in the commit.
git commit -m
- Session +
- Pre-push checks: (or repo-standard scripts per AGENTS.md).
pnpm lint && pnpm test - Push — same rules as push:
- when upstream exists; otherwise
git push(orgit push -u origin HEAD).git push --set-upstream origin <branch>
- If push fails (non-fast-forward / behind): use pull to merge the base per repo policy, resolve conflicts, re-run , then push again. Use
pnpm lint && pnpm testonly after intentional history rewrite—never plain--force-with-lease.--force - If push fails for auth / permissions: show the error; do not change remotes or protocols to “fix” it.
- 预检:执行。如果没有内容可提交,告知用户并停止推送。
git status --short --branch - 提交(遵循commit-jp规范)——完全按照commit-jp的要求执行:
- 查看会话记录 + /
git status/git diff;暂存目标路径(按需执行git diff --staged)。git add - 编写日语主题+正文(概要 / 理由 / テスト),使用命令,遵循Conventional Commits类型规范,如需添加Codex尾部信息则补充。
git commit -F <file> - 多行提交信息不要使用命令;避免将无用文件纳入提交。
git commit -m
- 查看会话记录 +
- 推送前检查:执行(或按照AGENTS.md中指定的仓库标准脚本执行)。
pnpm lint && pnpm test - 推送——遵循push的规则:
- 如果已设置上游分支,执行;否则执行
git push(或git push -u origin HEAD)。git push --set-upstream origin <branch>
- 如果已设置上游分支,执行
- 如果推送失败(非快进式/分支落后):使用pull操作按照仓库策略合并基准分支,解决冲突,重新执行**,然后再次推送。仅在有意重写提交历史且符合仓库策略时使用
pnpm lint && pnpm test**——绝对禁止使用普通的--force-with-lease。--force - 如果因认证/权限问题推送失败:展示错误信息;不要修改远程仓库地址或协议来“修复”问题。
Output
输出结果
- One new commit on the current branch (per commit-jp).
- Successful push to for that branch (upstream set on first push if needed).
origin
- 当前分支新增一个符合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
undefinedundefinedPresent Results to User
向用户展示结果
- List commands run and pass/fail for commit, lint, test, and push.
- Confirm branch name and that the tip is on after success.
origin - Do not claim a PR was created or updated—that is create-pr-jp.
- 列出执行的命令以及提交、lint检查、测试、推送的成功/失败状态。
- 确认分支名称,并在操作成功后告知用户分支最新提交已同步到。
origin - 绝对不要声称已创建或更新PR——此操作属于create-pr-jp。
Notes
注意事项
- Do not run or
git reset --hardto recover (exceptgit push --forcewhen history rewrite is intentional and policy allows—same as push).--force-with-lease - 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——与push**规范一致)。--force-with-lease - 如果提交失败,在提交步骤成功前不要进行推送操作。
- 如果提交成功后lint/测试失败,不要推送;按照仓库实践修复或修改提交,然后重新执行检查并推送。
Troubleshooting
故障排除
| Situation | Action |
|---|---|
| Nothing to commit | Report and stop; use push if only publishing existing commits |
| Commit message / staging wrong | Fix with commit-jp rules before pushing |
| Lint/test fails after commit | Do not push; fix, amend or follow-up commit, re-run |
| pull → merge base → |
| Auth / permission denied | Report verbatim; user fixes credentials or access |
| 场景 | 操作 |
|---|---|
| 无内容可提交 | 告知用户后停止操作;如果仅需发布已有的提交记录,使用push |
| 提交信息/暂存内容错误 | 按照commit-jp规则修复后再推送 |
| 提交后lint/测试失败 | 不要推送;修复问题、修改提交或补充提交后,重新执行 |
推送时提示 | 执行pull → 合并基准分支 → |
| 认证/权限被拒绝 | 原样展示错误信息;由用户修复凭证或权限问题 |