AGENT SKILL

sync

Bring the current branch up to date with its remote, or with the default branch when asked, without losing local work - fetch, rebase or merge, autostash.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 0
Forks
0

01 前言 Front Matter

name
sync
description
Bring the current branch up to date with its remote, or with the default branch when asked, without losing local work - fetch, rebase or merge, autostash.
allowed-tools
Bash(git status *) Bash(git fetch *) Bash(git pull *) Bash(git merge-base *) Bash(git rev-parse *) Bash(git symbolic-ref *) Bash(git remote *) Bash(git log *) Bash(git rev-list *) Bash(git rebase *) Bash(git merge *) Bash(git stash *) Read(/${CLAUDE_PLUGIN_ROOT}/**)
argument-hint
[base]
disable-model-invocation
true

03 SKILL.md 正文

Update the current branch. Argument: $ARGUMENTS

Gather the context and follow the rules in ${CLAUDE_PLUGIN_ROOT}/reference/git.md.

Steps

  1. git fetch --prune origin.
  2. Without argument: bring in the branch's own upstream.
    • No upstream: nothing to pull; say so (the branch has never been pushed).
    • If git merge-base --is-ancestor @{u} HEAD succeeds, the remote has nothing new for this branch: nothing to pull.
    • Otherwise git pull --rebase=merges --autostash. Rebasing replays only local commits that are not on the remote, =merges keeps their merge commits, and autostash sets uncommitted work aside and restores it afterwards. See « Bringing in the remote » in the reference.
    • Then, off the default branch, count what the default branch has that this one lacks: git rev-list --count HEAD..origin/<default> (the default from git symbolic-ref --short refs/remotes/origin/HEAD). When it is positive, the branch is not « up to date » even if its own upstream is: say how many commits origin/<default> has ahead, and offer /project:sync base to bring them in (a sync had said « up to date » while main had a commit more on the remote).
  3. With base: bring the default branch into the current one.
    • On the default branch itself, this is the same as step 2.
    • If the current branch has been pushed and others may have pulled it, merge (git merge origin/<default>) so its history stays valid for them. If it has never been pushed, rebase, keeping its merge commits (git rebase --rebase-merges --autostash origin/<default>). When unsure, ask.
  4. If --autostash could not re-apply the stash cleanly, the stash is kept: say so and show git stash list.

Report

Show git status --short --branch and git log --oneline -5, and state what came in (number of commits and from where) or that the branch was already up to date with its upstream, plus, without argument, the commits origin/<default> has ahead (step 2), with /project:sync base offered when there are some.

04 同仓库更多 Skills

matwi5
matwi5/mathis-plugins

reserve

Skill d'essai de la sonde, réservé à l'utilisateur. Répond par un mot fixe, sans rien faire d'autre.

★ 0
matwi5
matwi5/mathis-plugins

recap

Récap de l'usage Claude Code en chat, d'après ccusage et les relevés de requêtes de stats-board — la discussion en cours (coût, tokens, cache, durée, temps actif, attente de ta réponse, temps API, requêtes et la plus chère, modèles, spécialistes) et la journée (coût, tokens, temps actif, temps cumulé et temps API de ce poste, par projet et par modèle, discussions actives, bloc de 5 h et son rythme, autres postes publiés dans claude-usage), ou une mission entière (manager, workers et spécialistes, retrouvés par le début de leur titre ou par les worktrees groupe-* d'un projet, avec leur temps actif sans double compte et leur temps cumulé). À utiliser sur « /stats-board:recap », « récap de l'usage », « combien m'a coûté cette discussion », « combien j'ai consommé aujourd'hui », « coût de la journée », « récap de la mission », « combien a coûté la mission », « récap du parcours », « combien a coûté le parcours ». Pas pour ouvrir le panneau de statistiques, qui passe par /ccstats.

★ 0
matwi5
matwi5/mathis-plugins

install

Installe et initialise les plugins de la marketplace mathis-plugins choisis par l'utilisateur - choix par groupes, dépendances et prérequis, installation, réglages (Asana, partage des usages, modèle de session-tools, barre d'état) et bloc de règles dans le CLAUDE.md global ou du projet, montré avant écriture. Relançable pour ajouter ou retirer des plugins.

★ 0
matwi5
matwi5/mathis-plugins

version

Bump the project version with SemVer - detect the version files (package.json, pyproject.toml, Cargo.toml, Expo app config, Claude Code plugin manifests and their marketplace entry...), propose the bump from the commits since the last release, update every file consistently; handles Expo native vs OTA releases.

★ 0
matwi5
matwi5/mathis-plugins

push

Finish a piece of work and push it - commit what is left, run the project's checks, confirm the end-of-session files are up to date, sync with the remote and push without force.

★ 0
matwi5
matwi5/mathis-plugins

pr

Open a GitHub pull request for the current branch against the default branch or a given base, with a title and body written from the commits - the repository's PR template, or the plugin's (public release-notes section + internal details for reviewers).

★ 0