Agent skill
sync-rebase-and-push
Safely sync local commits with remote by rebasing onto origin/main and then push, following a GitHub Desktop-style flow. Use when asked to push/sync a branch, reconcile local and remote state, resolve rebase conflicts, run targeted tests or typechecks, and push only if checks pass.
Install this agent skill to your Project
npx add-skill https://github.com/inline-chat/inline/tree/main/.codex/skills/sync-rebase-and-push
SKILL.md
Sync Rebase And Push
Goal
Follow a safe, repeatable push flow:
- Check local and remote state.
- Print status and divergence.
- Rebase on
origin/main. - Detect and resolve conflicts.
- Run targeted tests/typechecks for touched areas.
- Push only when checks are green.
Workflow
1) Snapshot local and remote state
Run these commands in order:
git rev-parse --abbrev-ref HEAD
git status -sb
git fetch --prune origin
git status -sb
git for-each-ref --format='%(upstream:short)' "$(git symbolic-ref -q HEAD)"
Then print divergence:
- Current branch vs upstream (if upstream exists):
git rev-list --left-right --count HEAD...@{upstream}
- Current branch vs
origin/main:
git rev-list --left-right --count HEAD...origin/main
If there are uncommitted changes, stop and ask the user before proceeding. Do not auto-stash.
2) Rebase onto origin/main
Run:
git rebase origin/main
If rebase succeeds, continue to checks. If rebase stops, continue to conflict handling.
3) Show conflict state
When rebase conflicts occur, run:
git status -sb
git diff --name-only --diff-filter=U
For each conflicted file:
- Summarize what each side changed.
- Offer exactly 3 options: keep ours, keep theirs, or merge both surgically.
- Mark one option as recommended.
- Ask for user confirmation before applying non-trivial resolutions.
After each resolved file:
git add <file>
Continue rebase:
git rebase --continue
Repeat until rebase completes or another blocker appears.
4) Run targeted validation on modified areas
Determine touched scope after rebase:
git diff --name-only origin/main...HEAD
Map touched files to checks:
server/:cd server && bun run typecheck, then targetedbun testfor touched modules.web/:cd web && bun run typecheck.admin/:cd admin && bun run typecheck.cli/:cd cli && cargo check(orcargo testwhen behavior changed).apple/InlineKit:cd apple/InlineKit && swift build(andswift testif tests changed).apple/InlineUI:cd apple/InlineUI && swift build.proto/:bun run generate:proto, then run checks for all impacted consumers.
Prefer focused checks over full-suite runs unless user explicitly asks for full validation. If any check fails, do not push. Fix first, then re-run affected checks.
5) Push strategy
Decide push mode from branch/upstream state:
- No upstream branch:
git push -u origin <current-branch>
- Upstream exists and history was rewritten by rebase:
git push --force-with-lease
- Upstream exists and no rewrite needed:
git push
Never force-push main unless the user explicitly asks.
6) Final report
Always report:
- Branch name.
- Ahead/behind counts before and after rebase.
- Whether conflicts occurred and how they were resolved.
- Checks run and results.
- Push command used and result.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
inline-cli
Explain and use the Inline CLI (`inline`) for authentication, chats, users, spaces, messages, search, bots, typing, notifications, tasks, schema, attachments, downloads, JSON output, and configuration. Use when asked how to use the Inline CLI or its commands, flags, outputs, or workflows.
finalize
Finalize work to prepare a commit. Clean up unnecessary debug logs, remove unused methods added, do a final review to ensure tight elegant implementation, etc.
summarize-work
Based on the context, write a summary of changes, what's left, production readiness, tests run, and APIs/packages used.
branch-out
Isolate a subset of changes from a dirty local worktree (usually on main) into a clean feature branch, then commit, push, and open a PR. Use when the user asks to "branch out", "isolate my changes", "move this work to a new branch", or create a clean PR from only selected files/hunks.
mo-needs-to-review?
Check if uncommitted changes are important/risky/breaking to require a review before merge/production release.
fill-context
Read changes, summarize spec and work done so far, and prepare for working on next steps.
Didn't find tool you were looking for?