rebase-main
Fetch and rebase the current branch onto origin/main (or origin/master) for a clean linear history.
Skill by TJaenichen
Chalk Labs
Need help deploying rebase-main?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tjaenichen-rebase-main
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/rebase-main
Tools it pre-approves 5
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Bash(git:*),Read,Grep,Glob,Edit
What's inside
- Skill name
rebase-main- Description
- Fetch and rebase the current branch onto origin/main (or origin/master) for a clean linear history. Handles conflicts and reports what was done.
- License
- MIT
- Allowed tools
- Bash(git:*),, Read,, Grep,, Glob,, Edit
- Instructions
- 72 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (1)
- SKILL.md
SKILL.md (first lines)
# Rebase Current Branch onto Main
Rebase the current working branch onto the latest `origin/main` (or `origin/master`) for a clean, linear commit history. Handle conflicts and produce a summary report.
## Your Task
Execute the following steps in order:
### 1. Pre-flight checks
1. Run `git rev-parse --abbrev-ref HEAD` to get the current branch name.
2. **Safety check**: if on `main` or `master`, **stop** and warn the user. Do NOT rebase the main branch.
3. Run `git status --porcelain` to check for uncommitted changes.
- If there are uncommitted changes, **stop** and warn the user. Ask if they want to stash or commit first. Do NOT proceed with a dirty working tree.
4. Determine the main branch: check if `origin/main` exists (`git rev-parse --verify origin/main`). If not, fall back to `origin/master`.
### 2. Fetch and rebase
1. Run `git fetch origin` to get the latest remote state.
2. Run `git rev-list --count HEAD..{main-branch}` to see how many new commits are on main.
- If **0 commits** incoming, report "Already up to date with {main-branch}" and stop.
3. Capture the incoming commit list BEFORE rebasing: `git log --oneline HEAD..{main-branch}`.
4. Run `git rebase {main-branch}`.
5. Capture the rebase output.
### 3. Handle conflicts
If the rebase stops due to conflicts:
1. Run `git diff --name-only --diff-filter=U` to list conflicted files.
2. For **each conflicted file**:
a. Read the file to see the conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`).
b. Analyze the conflict:
- **Theirs-only changes** (our side is unchanged around the conflict): accept theirs.
- **Ours-only changes** (their side is unchanged around the conflict): accept ours.
- **Both sides changed**: Use your best judgment based on the code context. Prefer combining both changes when they don't overlap logically. If the conflict is complex or ambiguous, **abort the rebase** (`git rebase --abort`), report the issue, and let the user handle it manually.
c. Edit the file to remove conflict markers and apply the resolution.
d. Run `git add {file}` to mark it resolved.
3. After all conflicts in the current step are resolved, run `git rebase --continue`.
4. Repeat steps 1-3 if the rebase stops again on subsequent commits.
5. If more than **3 conflict rounds** occur, **abort the rebase** (`git rebase --abort`) and report to the user that manual resolution is needed.
### 4. Post-rebase report
Generate a clear report with:
```
## Rebase Report: {current-branch} onto {main-branch}
### Summary
- **New commits from main:** {count}
- **Conflicts:** {count} ({list of files, or "None"})
- **Status:** {Rebased cleanly | Rebased with conflict resolution | Aborted}
### Commits from main
{list of commits from git log --oneline captured BEFORE the rebase}
### Conflict Resolutions (if any)
For each resolved conflict:
- **{filename}**: {brief description of what conflicted and how it was resolved}
### Notes
- Your local commits have been replayed on top of the latest main.
- If your branch was previously pushed, you will need to force-push: `git push --force-with-lease`
```
## Important
- **Never rebase `main` or `master`** — check the branch name first
- If there are uncommitted changes, **do not proceed** — ask the user first
- If a conflict resolution is ambiguous, **abort the rebase** rather than guessing wrong
- Always use `git rebase --continue` (never `--skip`) after resolving conflicts
- Use `--force-with-lease` (not `--force`) in the push reminder — it's safer
- After completion, do NOT push — leave that to the user, but remind them about force-push if needed
- If anything goes wrong mid-rebase, run `git rebase --abort` to return to the original stateFrom TJaenichen/claude-code-harness, MIT.
More from TJaenichen/claude-code-harness
- 0.524score
panel-review
TJaenichen
Multi-agent panel review of any code target (a PR by id, a branch, the current branch, or specific paths) against project standards, with confidence-scored…
SkillBFreshness: BClaude Code - 0.524score
panel-review-fix
TJaenichen
Multi-agent review of the current branch's diff vs main, with optional in-place fix application.
SkillBFreshness: BClaude Code - 0.524score
db-search
TJaenichen
Search for database objects (tables, stored procedures, views, functions) in the scripted-out DB sources.
SkillBFreshness: BClaude Code +9 - 0.523score
build
TJaenichen
Build the solutions with warnings suppressed.
SkillBFreshness: BClaude Code +9 - 0.521score
ask-gemini
TJaenichen
Consult Google's Gemini LLM for a second opinion during planning, architecture decisions, code review, or any situation where a diverse AI perspective adds…
SkillBFreshness: BClaude Code +9 - 0.521score
ask-codex
TJaenichen
Consult OpenAI's Codex (ChatGPT) for a second opinion during planning, architecture decisions, code review, or any situation where a diverse AI perspective…
SkillBFreshness: BClaude Code +9 - 0.518score
finalize-task
TJaenichen
Commit, squash, push, and create a PR for the current branch.
SkillBFreshness: BClaude Code +9 - 0.518score
find-code
TJaenichen
Find controllers, services, models, and views by feature name in the Payments projects.
SkillBFreshness: BClaude Code +9 - 0.518score
starttask
TJaenichen
Start a new task - pull main, create worktree and feature branch from DevOps work item
SkillBFreshness: BClaude Code +9 - 0.518score
cleanup-worktree
TJaenichen
Remove a git worktree after a feature branch has been merged.
SkillBFreshness: BClaude Code +9 - 0.518score
db-query
TJaenichen
Execute SQL queries against the staging or dev database using sqlcmd with Windows integrated authentication.
SkillBFreshness: BClaude Code +9 - 0.518score
pr
TJaenichen
Manage Pull Requests - create, update description, add wiki links.
SkillBFreshness: BClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Aug 16, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from TJaenichen
- 0.524score
panel-review-fix
TJaenichen
Multi-agent review of the current branch's diff vs main, with optional in-place fix application.
SkillBFreshness: BClaude Code - 0.524score
db-search
TJaenichen
Search for database objects (tables, stored procedures, views, functions) in the scripted-out DB sources.
SkillBFreshness: BClaude Code +9 - 0.524score
panel-review
TJaenichen
Multi-agent panel review of any code target (a PR by id, a branch, the current branch, or specific paths) against project standards, with confidence-scored…
SkillBFreshness: BClaude Code - 0.523score
build
TJaenichen
Build the solutions with warnings suppressed.
SkillBFreshness: BClaude Code +9 - 0.521score
ask-codex
TJaenichen
Consult OpenAI's Codex (ChatGPT) for a second opinion during planning, architecture decisions, code review, or any situation where a diverse AI perspective…
SkillBFreshness: BClaude Code +9 - 0.521score
ask-gemini
TJaenichen
Consult Google's Gemini LLM for a second opinion during planning, architecture decisions, code review, or any situation where a diverse AI perspective adds…
SkillBFreshness: BClaude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get rebase-main running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
rebase-main skill. Agent Mart. https://agentmart.dev/skills/tjaenichen-rebase-main (last updated 2026-10-24)