Token导航 LogoToken导航

Agent Skill · 开发

commit-push-sync(提交推送同步)

commit-push-sync 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

commit-push-sync 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描有提醒项,按安装量在开发类的 21,746 个 Skill 里排第 19,470。

总安装 269周安装 11GitHub Stars 6下载 87核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:commit-push-sync(提交推送同步)
来源仓库:https://github.com/yulonglin/dotfiles
仓库路径:skills/commit-push-sync
安装命令:
npx skills add https://github.com/yulonglin/dotfiles --skill commit-push-sync
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/yulonglin/dotfiles --skill commit-push-sync

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

commit-push-sync 自动化提交本地更改、使用上下文感知策略同步远程并推送更新。适用于需要一站式处理 commit、sync 和 push 的完整 Git 工作流。根据远程状态选择 safest strategy,整合 staging、commit 和推送操作。

触发于“commit and push”、“sync changes”等请求,建议确认网络连接和权限。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/commit-push-sync

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/yulonglin/dotfiles --skill commit-push-sync;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

commit-push-sync 怎么安装?

在终端执行 npx skills add https://github.com/yulonglin/dotfiles --skill commit-push-sync。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

commit-push-sync 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

commit-push-sync 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

commit-push-sync 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

commit-push-sync 用的人多吗?

公开数据是累计安装 269 次,近一周安装 11 次,下载 87 次,GitHub 6 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

commit-push-sync 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
commit-push-sync

提交推送同步 · 本页

2696需要联网未明确有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Commit, Smart Sync, and Push Workflow

Automates the complete workflow of committing local changes, syncing with remote using a context-aware pull strategy, and pushing updates.

Purpose

Handle the full git workflow in a single command:

  1. Stage and commit changes (following commit skill best practices)
  2. Fetch and evaluate remote state
  3. Sync with remote using the safest strategy for the situation
  4. Push local commits to remote

When to Use

Trigger this skill when the user requests:

  • "commit and push"
  • "commit push"
  • "sync changes"
  • "push changes" (after uncommitted work detected)
  • "commit and sync"
  • "update remote"

Do NOT use when:

  • User only wants to commit (use /commit skill)
  • User only wants to push existing commits (use direct git push)
  • Working on a branch that shouldn't be pushed yet
  • Conflicts are expected (handle manually)

Workflow

Step 1: Fetch and Evaluate State

CRITICAL: Fetch first. The local tracking ref (@{u}) is stale until you fetch. Without fetching, git log..@{u} uses cached data and can miss remote changes.

First, check if upstream tracking exists and determine the correct remote:

UPSTREAM_REF=$(git rev-parse --abbrev-ref @{u} 2>/dev/null)

If no upstream tracking branch (UPSTREAM_REF is empty): Skip to Step 2 (commit), then push with -u origin <branch> in Step 4.

If upstream exists, extract the remote name and fetch it:

UPSTREAM_REMOTE=$(echo "$UPSTREAM_REF" | cut -d/ -f1)  # e.g., "origin" from "origin/main"
git fetch "$UPSTREAM_REMOTE"  # MUST succeed — abort entire workflow on failure

IMPORTANT: Always fetch the remote that @{u} actually points to, not hardcoded origin. A branch may track upstream/main or another remote — fetching the wrong remote leaves @{u} stale and causes incorrect state classification.

If fetch fails (network error, auth failure, etc.), stop the entire workflow and notify the user. Do not proceed with stale data.

If upstream exists, gather state (run in parallel):

git status                          # Uncommitted changes and branch info
git log @{u}.. --oneline            # Local-only commits (ahead count)
git log ..@{u} --oneline            # Remote-only commits (behind count)
git log @{u}.. --merges --oneline   # Merge commits in local history

Classify the state using the Smart Pull Decision Tree:

After git fetch origin:
+-- Local ahead, remote has nothing     -> just push (no pull needed)
+-- Local behind, no local commits      -> git pull --ff-only
+-- Diverged:
|   +-- Local has merge commits?        -> git pull --no-rebase (merge)
|   +-- >20 local commits to replay?    -> git pull --no-rebase (merge)
|   +-- Few commits, no merges          -> git pull --rebase
|   +-- Any pull fails?                 -> abort, show state, ask user
+-- @{u} not configured                 -> commit, git push -u origin <branch>

Principle: rebase only when cheap and safe (few commits, no merges). Otherwise merge. Never rebase merge commits — rebase drops them and replays their individual commits, causing massive conflicts.

Step 2: Commit Changes (if needed)

If uncommitted changes exist, follow the commit skill workflow:

  1. Gather context (run in parallel): git status # See untracked files (NEVER use -uall flag) git diff --staged # See staged changes git diff # See unstaged changes git log -10 --oneline # Recent commits for style reference
  2. Draft commit message:

- Summarize nature of changes (feature/fix/refactor/docs/etc.) - Focus on "why" rather than "what" - Match repository's commit style (from git log) - Keep concise (1-2 sentences)

  1. Stage and commit (run sequentially): git add [specific files] # Prefer specific files over "git add -A" # Sandbox-safe commit (NEVER use heredoc — sandbox blocks /tmp) # For multi-line messages: mkdir -p "$TMPDIR" && printf '%s\n' "subject line" "" "Body details here" > "$TMPDIR/commit_msg.txt" && git commit -F "$TMPDIR/commit_msg.txt" # For single-line messages: git commit -m "subject line" git status # Verify commit succeeded

Important commit rules (from CLAUDE.md):

  • NEVER skip hooks (no --no-verify)
  • NEVER use git add -A or git add. (specify files to avoid secrets)
  • NEVER commit secrets (.env, credentials.json, etc.)
  • NEVER use heredoc (<<EOF) in commit commands (sandbox blocks /tmp)
  • If pre-commit hook fails, create NEW commit after fixing (never --amend)

Step 3: Sync with Remote (if needed)

Based on the state classification from Step 1, choose the appropriate strategy:

Case A: Local strictly ahead (no remote-only commits)

Skip this step entirely. Go straight to Step 4 (push). This is the most common case.

Case B: Local behind, no local commits (fast-forward)
git pull --ff-only

This cannot fail with conflicts. If it fails, something unexpected happened — abort and ask user.

Case C: Diverged — local has merge commits OR >20 local commits

Use merge (not rebase) to preserve merge commits and avoid replaying a large number of commits:

git pull --no-rebase

Why not rebase here: git rebase drops merge commits by default and replays their individual commits. A merge commit containing N upstream commits would expand into N individual replays, each potentially conflicting. This is how the 81-commit rebase disaster happens.

If merge conflicts occur:

  1. Immediately abort: git merge --abort
  2. Show the user the conflicting state: git status
  3. Explain what diverged: show git log @{u}.. --oneline and git log..@{u} --oneline
  4. Ask the user how to proceed — do NOT auto-resolve
Case D: Diverged — few local commits (<= 20), no merge commits

Rebase is safe here — small, linear history is easy to replay:

git pull --rebase

If rebase conflicts occur:

  1. Immediately abort: git rebase --abort
  2. Show the user the conflicting state: git status
  3. Explain what diverged
  4. Ask the user how to proceed — do NOT auto-resolve
General conflict handling
  • NEVER attempt automatic conflict resolution — always abort and ask user
  • NEVER continue a rebase/merge with unresolved conflicts
  • Show conflicting files with git status
  • Provide guidance:

- For rebase: resolve, git add, git rebase --continue, or git rebase --abort - For merge: resolve, git add, git commit, or git merge --abort

Step 4: Push to Remote

Push commits to remote:

git push

If no upstream tracking branch:

git push -u origin <branch-name>

Ask user to confirm branch name before pushing.

Handle push failures:

ErrorCauseSolution
rejected (non-fast-forward)Remote updated after our fetchRe-fetch, re-evaluate state, sync again
no upstream branchNew branch never pushedgit push -u origin <branch> (confirm with user)
protected branchBranch has push restrictionsNotify user (need PR or permissions)

Force push guidance:

  • NEVER suggest git push --force for main/master — warn the user if they request it
  • For other branches, only suggest after explicit user request
  • Always use --force-with-lease over --force — it checks that the remote hasn't been updated by someone else since your last fetch
  • See references/force-push-guidelines.md for detailed guidance
  • Warn: "Force push will overwrite remote history. --force-with-lease provides a safety check."

Step 5: Verify Success

After successful push:

git status            # Should show "Your branch is up to date with 'origin/<branch>'"
git log -3 --oneline  # Show recent commits for confirmation

Output summary:

  • "Committed: [commit message]" (if committed)
  • "Synced: [N] commits from remote via [merge/rebase/fast-forward]" (if synced)
  • "Pushed: [N] commits to origin/"

Stash Workflow (Alternative Pattern)

For users with unstaged changes who prefer stash over committing. Only use when remote actually has commits to pull (check after fetch).

WARNING: .claude/settings*.json files cannot be stashed — the sandbox denies write/unlink on these files. If the working tree has dirty settings files:

  1. Fallback: commit the non-settings dirty files first, then push directly
  2. Or: just push if local is strictly ahead (stash is unnecessary)
git fetch origin

# Only if `git log ..@{u} --oneline` shows remote commits:
LOCAL_MERGES=$(git log @{u}.. --merges --oneline | wc -l)
LOCAL_COUNT=$(git log @{u}.. --oneline | wc -l)

git stash

if [ "$LOCAL_MERGES" -gt 0 ] || [ "$LOCAL_COUNT" -gt 20 ]; then
  git pull --no-rebase   # Preserve merge commits
else
  git pull --rebase      # Safe for small linear history
fi

git stash pop

Handle stash pop conflicts:

  • Notify user about conflicts after stash pop
  • Show conflicting files
  • Provide guidance: resolve conflicts, then git add [files]
  • No git stash drop until conflicts resolved

Edge Cases

Case 1: Detached HEAD

# Check if detached
git symbolic-ref -q HEAD || echo "Detached HEAD"

If detached, notify user: "Cannot push from detached HEAD. Create a branch first: git checkout -b <branch-name>"

Case 2: No Remote Tracking Branch

Handled in Step 1 (detected by git rev-parse --abbrev-ref @{u}) and Step 4 (push with -u).

Case 3: Diverged Branches with Merge Commits

This is the critical case that motivated the smart pull strategy. When local history contains merge commits (e.g., from git merge upstream/main):

  • NEVER rebase — rebase drops the merge commit and replays all N individual commits from the merged branch
  • Always merge — git pull --no-rebase preserves the merge commit intact
  • Show the user: git log @{u}.. --merges --oneline to explain why merge was chosen

Case 4: Nothing to Commit or Push

git status                 # "nothing to commit, working tree clean"
git log @{u}.. --oneline   # No output = no unpushed commits

Notify user: "No changes to commit or push. Working tree is clean and up to date."

Case 5: Fetch Fails

If git fetch origin fails:

  • Abort the entire workflow — do not proceed with stale tracking refs
  • Show the error to the user
  • Common causes: network issues, auth expired, remote renamed/deleted

Common Mistakes to Avoid

Don't:

  • Run git add -A or git add. (risk committing secrets)
  • Use --no-verify to skip hooks
  • Force push to main/master without explicit request
  • Auto-resolve merge conflicts (always involve user)
  • Amend commits after hook failures
  • Skip verification steps
  • Use heredoc (<<EOF) in commit commands (sandbox blocks /tmp)
  • Rebase when local history contains merge commits
  • Rebase >20 commits without warning the user
  • Use --force when --force-with-lease is available

Do:

  • Stage specific files by name
  • Choose pull strategy based on local history (merge commits? commit count?)
  • Let hooks run (respect pre-commit checks)
  • Create new commits after hook failures
  • Use $TMPDIR for commit message files
  • Verify success with git status
  • Handle errors gracefully with clear user guidance
  • Use --force-with-lease over --force when force push is needed

Integration with Rules

This skill follows the smart pull strategy from rules/safety-and-git.md:

Context-aware pull strategy (not unconditional rebase):

  • Rebase only when cheap and safe (few commits, no merges)
  • Merge when local has merge commits or many commits
  • Fast-forward when local has no work
  • Skip pull entirely when local is strictly ahead

Git Safety Protocol:

  • Never update git config
  • Never run destructive commands (--force push to main)
  • Never skip hooks
  • Always create new commits (not amend after failures)
  • Prefer specific file staging

Sandbox-safe commits:

  • Use printf + git commit -F for multi-line messages
  • Use -m for single-line messages
  • Never use heredoc (<<EOF) in commit commands

Additional Resources

Reference Files

For detailed guidance:

  • references/conflict-resolution.md - Handling merge conflicts during rebase or merge
  • references/force-push-guidelines.md - When and how to force push safely

Related Skills

  • /commit - Just commit workflow (no push)
  • Standard git commands for manual control

Quick Command Reference

# ALWAYS fetch the correct remote first (matches @{u})
UPSTREAM_REMOTE=$(git rev-parse --abbrev-ref @{u} 2>/dev/null | cut -d/ -f1)
git fetch "${UPSTREAM_REMOTE:-origin}"

# Check state AFTER fetch
git status
git log @{u}.. --oneline            # Unpushed local commits
git log ..@{u} --oneline            # Remote-only commits to pull
git log @{u}.. --merges --oneline   # Merge commits in local history

# Decision tree:
# Local strictly ahead (no remote-only commits) — just push
git push

# Local behind only (no local commits) — fast-forward
git pull --ff-only && git push

# Diverged with merge commits or >20 local commits — merge
git pull --no-rebase && git push

# Diverged with few commits, no merges — rebase
git pull --rebase && git push

# No upstream tracking — set it
git push -u origin <branch>

# Sandbox-safe commit (multi-line)
mkdir -p "$TMPDIR" && printf '%s\n' "subject" "" "body" > "$TMPDIR/commit_msg.txt" && git commit -F "$TMPDIR/commit_msg.txt"

# Verify success
git status  # Should show "up to date with origin/<branch>"
git log -3 --oneline

Success Criteria

A successful commit-push-sync completes when:

  1. All changes are committed (if any uncommitted work existed)
  2. Remote changes are synced using the appropriate strategy (if any remote updates existed)
  3. Local commits are pushed to remote
  4. git status shows "Your branch is up to date with 'origin/'"
  5. No conflicts or errors remain unresolved
  6. Merge commits in local history are preserved (not flattened by rebase)

If any step fails, provide clear guidance and stop — don't proceed to next step until user resolves the issue.

平台分布

Codex

34.69%
按下载量换算30

Claude

28.26%
按下载量换算25

Cursor

20.79%
按下载量换算18

Gemini CLI

9.5%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills