github-sync
GitHub Sync
Overview
Use scripts/sync-repo.sh instead of rewriting ad-hoc git fetch and git pull logic. The script resolves the sync target, creates a local tracking branch when needed, and only performs fast-forward updates.
Workflow
- Check whether the user wants the remote default branch, a specific branch, or the current branch.
- Prefer
originunless the user explicitly asks for another remote. - Run the bundled script:
scripts/sync-repo.sh
scripts/sync-repo.sh --branch main
scripts/sync-repo.sh --current
- If the script reports that a branch switch would be unsafe because the worktree is dirty, stop and ask the user instead of stashing, resetting, or forcing the switch.
- After a successful sync, use
git status -sbwhen the user wants explicit verification.
Branch Selection
- No flags: sync the remote default branch from
origin/HEAD. --branch <name>: sync that branch fromorigin/<name>.--current: sync the currently checked out branch without switching away first.
Hard Rules
- Never auto-stash, reset, rebase, or create a merge commit as part of sync.
- Use fast-forward-only updates.
- If
origin/HEADis unavailable and no explicit branch was provided, stop and ask which branch to sync. - If the requested remote branch does not exist, stop and report the missing branch clearly.
- For branch-creation workflows that must branch from updated
main, runscripts/sync-repo.sh --branch mainfirst.
Script
scripts/sync-repo.sh: fetches fromorigin, resolves the target branch, creates a local tracking branch when needed, and fast-forwards it safely.
More from mindgames/skills
github-pull-request
Use when the user asks to create a pull request. Build a complete PR using best-practice structure with rich details on changes, verification, QA evidence, risks, and rollout notes. Include issue linkage and clear testing commands/results in the PR body.
2branch
Use when a user asks to create a new local git branch and start issue work (for example, "create branch" or "start working on issue XYZ"). Use this for issue-based branch naming in the `type/scope-short-description` pattern and for always syncing local `main` from `origin/main` before creating the new branch, creating the local tracking `main` branch first when needed.
1gh-pr-audit
Perform a full local audit of one or more GitHub PRs, run repository-native deterministic checks, apply result labels, and post a structured review comment. Use when a PR in this repo or under projects/* needs a deep, evidence-based review across any language or stack.
1gh-fix-ci
Use when a user asks to debug or fix failing GitHub PR checks that run in GitHub Actions; use `gh` to inspect checks and logs, summarize failure context, draft a fix plan, and implement only after explicit approval. Treat external providers (for example Buildkite) as out of scope and report only the details URL.
1github-issue
Create complete, implementation-ready GitHub issues from user input and publish them with `gh issue create`. Use when asked to create/file/open a new issue in any repository, including cases where requirements must be structured into clear scope, acceptance criteria, constraints, and done-when outcomes.
1gh-address-comments
Help address review/issue comments on the open GitHub PR for the current branch using gh CLI; verify gh auth first and prompt the user to authenticate if not logged in.
1