/linux:linux-repo-syncfrom linux
Provides safe, unattended or menu-driven Git repository update logic that preserves tracked and untracked local work. Uses pull --rebase --autostash and porcelain dirty-checks; never resets or force-cleans.
Ships in linux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Fully portable. This skill is git-only and identical on both families
(Debian/Ubuntu and the RHEL family: Fedora, RHEL, CentOS Stream, Rocky, Alma,
Oracle). The doctrine below — pull --rebase --autostash, porcelain
dirty-checks, never reset --hard/clean -fd — is distro-neutral. The only
difference is installing git itself.
| Concept | Debian/Ubuntu | RHEL family |
|---|---|---|
| Install git | apt install git | dnf install git |
Everything else (git pull --rebase --autostash, status, conflict recovery) | identical | identical |
In sk-* scripts use pkg_install git from common.sh if you must ensure git
is present. See docs/multi-distro/plan.md.
git pull a developer runs by hand in their own
checkout and watches the output of.linux-bash-scripting first, then
apply this doctrine to the git steps.| Artefact | Source | Required? | If absent |
|---|---|---|---|
| Repository path(s) and intended branch | Operator or approved registry | yes | Skip the target; never search and update arbitrary repos |
| Interactive or unattended mode | Scheduler/operator | yes | Default to report-only planning |
| Remote/authentication and post-pull command | Repository owner | for update/build | Do not infer credentials or run a build |
| Deployment/change authority | Service owner | for integration | Fetch/status only; do not integrate commits |
Read/search status and fetch inspection may be read-only. Pull/rebase changes the working tree and needs explicit authority. Never delete, reset, auto-resolve, force-push, expose credentials, or run an unapproved post-pull command.
If network, credentials, Git, upstream tracking, or a clean conflict state is unavailable, preserve the tree and report branch, status, and the failed step. Do not call a fetched or conflicted repository updated.
| State | Action | Failure avoided |
|---|---|---|
| Dirty tracked work | Warn and use --rebase --autostash | Lost local edits |
| Untracked files present | Preserve them and report collision risk | Deleted uploads/config |
| Rebase or stash conflict | Stop with recovery commands | Destructive auto-resolution |
| Detached HEAD or missing upstream | Stop and request intended branch | Updating the wrong history |
<path>/.git exists).git status --porcelain before touching it.git pull --rebase --autostash so local work is stashed,
the rebase runs, and the work is re-applied on top.git reset --hard HEAD in automation. Fix: preserve local work with rebase/autostash and stop on conflict.git clean -fd or -fdx. Fix: leave untracked files untouched and report collisions..env, or generated config to avoid conflicts. Fix: stop and report the conflicting path.| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Per-repo update result | Operator | Records branch, before/after commit, dirty state, and outcome |
| Conflict handoff | Repository owner | Gives exact status plus safe continue/abort/stash recovery |
| Post-pull result | Service owner | Runs only after successful integration and records exit status |
| Artefact | Acceptance |
|---|---|
| Repository update evidence | Includes porcelain status, branch/upstream, before/after IDs, pull/autostash state, build exit, skipped repos, and redacted credentials |
On conflict, leave Git's state intact and show git status, git rebase --continue, git rebase --abort, and git stash list. Never choose the recovery path for the owner.
A production checkout has a modified tracked config and an untracked upload. Report both, run the authorised git pull --rebase --autostash, leave the upload untouched, and record commit IDs. If the autostash conflicts, stop before the build and hand the exact recovery state to the owner.
../../docs/continuous-improvement/safe-reversible-operations-standard.md
../../docs/continuous-improvement/value-stream-5s-qc-story.md
This is a STANDARD, not a suggestion. It exists because a repo-update menu
script once ran git reset --hard HEAD + git clean -fd before pulling and
silently wiped a developer's uncommitted edits. That must never be possible
again on any server we manage.
git reset --hard in an automated or menu repo-update
script. It destroys uncommitted changes to tracked files with no undo.git clean -fd (or -fdx) in an automated or menu
repo-update script. It deletes untracked files — uploads, .env,
generated config — that git is not tracking precisely because they must
survive.git pull --rebase --autostash. --autostash stashes any
local changes before the rebase and re-applies them afterwards, so local
work is preserved through the update. This is the default pull command for
every server-side update.git status --porcelain. If it is non-empty, warn the operator that local
changes exist (and will be stashed and re-applied, not discarded). Never
discard them.git rebase --continue after resolving the conflicting files, orgit rebase --abort to return to the pre-pull state, andgit stash list — the autostash is preserved here; recover it with
git stash pop once the tree is clean.update_repo_safely() {
local path="$1"
[[ -d "$path/.git" ]] || { echo "not a git repo: $path" >&2; return 1; }
cd "$path" || return 1
# 1. Detect a dirty working tree — warn, never wipe.
if [[ -n "$(git status --porcelain)" ]]; then
echo "WARNING: $path has local changes."
echo " They will be stashed and re-applied, not discarded."
fi
# 2. Pull with rebase + autostash: local work is preserved.
if git pull --rebase --autostash; then
echo "updated: $(git rev-parse --abbrev-ref HEAD) -> $(git log -1 --oneline)"
else
# 3. Conflict — stop and hand the operator a recovery path.
echo "ERROR: pull/rebase hit a conflict in $path." >&2
echo " Resolve the files, then: git rebase --continue" >&2
echo " Or roll back the pull: git rebase --abort" >&2
echo " Your stashed local work: git stash list (recover with: git stash pop)" >&2
return 1
fi
}
What this never does: no git reset --hard, no git clean, no removal of
untracked files, no automatic conflict resolution.
/usr/local/bin/update-all-repos is the menu-driven repo-update tool that
must exist on every managed server (see
notes/update-all-repos-setup.md). It
must follow this doctrine: a porcelain dirty-check plus
git pull --rebase --autostash, never git reset --hard + git clean -fd.
The sk-update-all-repos script (linux-site-deployment) is the engine
version of the same tool and is held to the same standard.
If you find any repo-update script on a server still doing git reset --hard
or git clean -fd, that is a bug to fix, not a pattern to copy.
This skill installs the following scripts to /usr/local/bin/. To install:
sudo install-skills-bin linux-repo-sync
| Script | Source | Core? | Purpose |
|---|---|---|---|
| sk-update-all-repos | scripts/sk-update-all-repos.sh | no | Pull every registered git repo on this server using git pull --rebase --autostash and a porcelain dirty-check; interactive menu plus --all/--repo flags. This is the engine implementation of the safe-update doctrine above and is owned by this skill. |
# A repo-update script is safe iff this returns nothing:
grep -nE 'git[[:space:]]+reset[[:space:]]+--hard|git[[:space:]]+clean[[:space:]]+-fd' /usr/local/bin/update-all-repos
# And iff it pulls with autostash:
grep -n 'pull --rebase --autostash' /usr/local/bin/update-all-repos
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors./linux-auditd-rulesUse when inspecting, designing, testing, persisting, or querying auditd rules for forensic attribution on Debian/Ubuntu or RHEL-family hosts. Covers watches, syscalls, loss, and immutable mode; use linux-file-integrity for drift and linux-benchmark-scanning for scoring./linux-bash-scriptingUse when writing or reviewing portable sk-* Bash scripts for this engine, including common.sh primitives, flags, preview mode, and safety gates; use linux-repo-sync for Git-update behaviour and not for one-off commands./linux-benchmark-scanningUse when running read-only OpenSCAP or Lynis scans, selecting distro-matched profiles, interpreting failures, or drafting remediation on Debian/Ubuntu or RHEL-family hosts. Use linux-auditd-rules for attribution and linux-file-integrity for AIDE drift.npx claudepluginhub peterbamuhigire/linux-skills --plugin linuxOther plugins' skills for the same job