rebase-commit-push-pr
farm-fe/farm/.agents/skills/rebase-commit-push-pr/SKILL.md
Fetch origin/main, rebase current branch, resolve conflicts safely, then commit and push changes; create a PR if none exists for the branch.
Skill5.6k starsChanged 5 months ago
- Deletes or force-pushes
- Commits and pushes
What's in it
- Steps
- Guardrails
---
name: rebase-commit-push-pr
description: Fetch origin/main, rebase current branch, resolve conflicts safely, then commit and push changes; create a PR if none exists for the branch.
license: MIT
compatibility: Requires git repository with origin remote and GitHub CLI (gh) for PR checks/creation.
metadata:
author: farm
version: "1.0"
---
Safely sync a working branch with `origin/main`, handle rebase conflicts, then publish and open a PR if needed.
## Steps
1. Inspect branch and working tree
- `git branch --show-current`
- `git status --short`
- If there are unresolved conflicts already, stop and ask for user direction.
2. Fetch and rebase onto main
- `git fetch origin main`
- `git rebase origin/main`
3. Resolve rebase conflicts (if any)
- Check conflicted files: `git status --short`
- Resolve each conflict intentionally (do not run destructive resets).
- Stage resolved files: `git add <paths>` or `git rm <paths>`.
- Continue: `git rebase --continue`.
- Repeat until rebase finishes or explicit user input is required.
4. Commit user-requested local changes (only if needed)
- If `git status --short` is empty, skip commit.
- Else stage desired files (`git add -A` by default), then commit with a conventional message.
5. Push branch
- `git push`
- If push is rejected after rebase, use `git push --force-with-lease` only when user explicitly asked for rewritten-history push.
6. Ensure a PR exists
- Detect current branch PR:
- `gh pr list --head "$(git branch --show-current)" --json number,title,state,url`
- If no PR exists, create one:
- `gh pr create --fill`
- If `--fill` fails due to missing metadata, provide explicit `--title` and `--body`.
7. Report result
- Branch name
- Rebase outcome (and conflict files resolved)
- Commit hash/title created in this run (or note "no new commit")
- Push destination
- PR URL (existing or newly created)
## Guardrails
- Never use `git reset --hard`, `git checkout --`, or force push without explicit user approval.
- Do not amend commits unless explicitly requested.
- If hooks/tests fail during commit or push, surface the first failure and stop.
More agent context in farm-fe/farm
53 other files this repository gives its agents.
AGENTS.md
CLAUDE.md
Skill
- a5c-ai-docusaurus.agents/skills/a5c-ai-docusaurus/SKILL.md
- agent-browser.agents/skills/agent-browser/SKILL.md
- brainstorming.agents/skills/brainstorming/SKILL.md
- building-farm-from-source.agents/skills/building-farm-from-source/SKILL.md
- creating-changesets.agents/skills/creating-changesets/SKILL.md
- dispatching-parallel-agents.agents/skills/dispatching-parallel-agents/SKILL.md
- executing-plans.agents/skills/executing-plans/SKILL.md
- farm-ready-gate.agents/skills/farm-ready-gate/SKILL.md
- find-skills.agents/skills/find-skills/SKILL.md
- finishing-a-development-branch.agents/skills/finishing-a-development-branch/SKILL.md
- git-commit-push.agents/skills/git-commit-push/SKILL.md
- receiving-code-review.agents/skills/receiving-code-review/SKILL.md
- requesting-code-review.agents/skills/requesting-code-review/SKILL.md
- rust-best-practices.agents/skills/rust-best-practices/SKILL.md
- rust-engineer.agents/skills/rust-engineer/SKILL.md
- self-improving-agent.agents/skills/self-improving-agent/SKILL.md
- subagent-driven-development.agents/skills/subagent-driven-development/SKILL.md
- systematic-debugging.agents/skills/systematic-debugging/SKILL.md
- test-driven-development.agents/skills/test-driven-development/SKILL.md
- using-git-worktrees.agents/skills/using-git-worktrees/SKILL.md
- using-superpowers.agents/skills/using-superpowers/SKILL.md
- verification-before-completion.agents/skills/verification-before-completion/SKILL.md
- writing-plans.agents/skills/writing-plans/SKILL.md
- writing-skills.agents/skills/writing-skills/SKILL.md
- a5c-ai-docusaurus.claude/skills/a5c-ai-docusaurus/SKILL.md
- agent-browser.claude/skills/agent-browser/SKILL.md
- brainstorming.claude/skills/brainstorming/SKILL.md
- creating-changesets.claude/skills/creating-changesets/SKILL.md
- dispatching-parallel-agents.claude/skills/dispatching-parallel-agents/SKILL.md
- executing-plans.claude/skills/executing-plans/SKILL.md
- farm-ready-gate.claude/skills/farm-ready-gate/SKILL.md
- find-skills.claude/skills/find-skills/SKILL.md
- finishing-a-development-branch.claude/skills/finishing-a-development-branch/SKILL.md
- gh-cli.claude/skills/gh-cli/SKILL.md
- git-commit-push.claude/skills/git-commit-push/SKILL.md
- rebase-commit-push-pr.claude/skills/rebase-commit-push-pr/SKILL.md
- receiving-code-review.claude/skills/receiving-code-review/SKILL.md
- requesting-code-review.claude/skills/requesting-code-review/SKILL.md
- rust-best-practices.claude/skills/rust-best-practices/SKILL.md
- rust-engineer.claude/skills/rust-engineer/SKILL.md
- self-improving-agent.claude/skills/self-improving-agent/SKILL.md
- subagent-driven-development.claude/skills/subagent-driven-development/SKILL.md
- systematic-debugging.claude/skills/systematic-debugging/SKILL.md
- test-driven-development.claude/skills/test-driven-development/SKILL.md
- using-git-worktrees.claude/skills/using-git-worktrees/SKILL.md
- using-superpowers.claude/skills/using-superpowers/SKILL.md
- verification-before-completion.claude/skills/verification-before-completion/SKILL.md
- writing-plans.claude/skills/writing-plans/SKILL.md
- writing-skills.claude/skills/writing-skills/SKILL.md
- e2e-example-acceptance.github/skills/e2e-example-acceptance/SKILL.md
- farmfe-guideskills/farmfe-guide/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool registry_write, action report. How to connect one.

