Skip to content
Agentmart
Submit a tool

mid-session-master-advance-rebase

Use when `git diff origin/master..HEAD` (or main) shows files you never touched as DELETED/modified, yet `git status` is clean and `git log` shows only your…

Skill by hjr15

IndexedMIT
Write a review

Chalk Labs

Need help deploying mid-session-master-advance-rebase?

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.

Book a call

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/hjr15-mid-session-master-advance-rebase

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.

We use your email only for this newsletter. Privacy

About

Use when `git diff origin/master..HEAD` (or main) shows files you never touched as DELETED/modified, yet `git status` is clean and `git log` shows only your commits — origin advanced past your fork point and the diff shows its new commits inverted. Fix with `git fetch && git rebase`.

Use cases: productivity

No 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/mid-session-master-advance-rebase

What's inside

Skill name
mid-session-master-advance-rebase
Description
Use when `git diff origin/master..HEAD` (or main) shows files you never touched as DELETED/modified, yet `git status` is clean and `git log` shows only your commits — origin advanced past your fork point and the diff shows its new commits inverted. Fix with `git fetch && git rebase`.
License
MIT
Instructions
53 lines in SKILL.md · view on GitHub

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Mid-Session Master Advance Rebase

## Overview

When sister sessions are running in parallel and merging to the default branch, `origin/master` (or `origin/main`) advances without your worktree noticing. `git diff origin/master..HEAD` becomes misleading: it shows the **inverse** of any new upstream commits — a file added on master shows as DELETED in your diff; a line added shows as removed. Easy to mistake for cross-session contamination of your worktree.

## When to Use

- Pre-push verification: `git diff origin/master..HEAD` shows unfamiliar file changes
- `git status` says the working tree is clean
- `git log --oneline <fork-point>..HEAD` shows only your own commits
- You're in a worktree with one or more sister worktrees on other branches

## Diagnosis

```bash
git fetch origin
git log --oneline origin/master | head -3      # has master moved past your fork point?
git log --oneline <my-branch> | head -3        # what's your branch tip?
git merge-base HEAD origin/master              # is your fork point now behind origin?
```

If origin/master has commits beyond your fork point, that's the source of the "spurious diff" — it is upstream's new work shown inverted, not anything in your tree.

## Fix

```bash
git rebase origin/master
# rebases are usually clean for non-overlapping packages — re-run the test suite to verify
git diff origin/master..HEAD                   # now shows only your changes
```

## Why rebase rather than just push

Pushing as-is works (GitHub computes its own merge-base), but rebasing first:

- Makes the local `git diff origin/master..HEAD` honest, so pre-PR verification is meaningful
- Catches real conflicts EARLY instead of in the PR
- Keeps your branch linearisable for squash-merge

## Neighbouring hazards (dirty tree, not the clean-diff case)

This skill assumes a **clean** worktree where the confusion is only in the diff base. Two dirty-tree variants of "origin advanced" need different handling:

- **Untracked file blocks the ff-pull / rebase.** If `git fetch && git rebase` or `git pull --ff-only` aborts with *"untracked working tree files would be overwritten by merge"*, an untracked local copy — often a parallel lane's file or an Obsidian phantom — collides with a file the incoming history adds as tracked. Confirm content-equality (`git show origin/<branch>:<path>` + `git diff --no-index`), move the untracked copy to `/tmp`, re-pull, then discard the copy.
- **The user's checkout is many commits behind origin AND dirty.** Distinct from the agent's own clean worktree: never blow it away to "get latest". Snapshot everything (tracked + untracked) onto a `wip-backup-<date>` branch (`git switch -c wip-backup-<date> && git add -A && git commit` — skip `.claude/`), then `git branch -f <main> origin/<main>` + `git switch <main>` to surface the merged work losing nothing. Prove no loss by diffing `wip-backup-<date>` vs `origin/<main>` (the "lost edits" are usually just stale older copies) before declaring done; leave the backup branch in place as a safety net.

## Related

- parallel worktree tasks — the multi-worktree setup that makes this happen
- Distinct from a *dirty-tree* hazard — here the tree is clean and the confusion is purely in the diff base.

From hjr15/claude-kit, MIT.

More from hjr15/claude-kit

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Jul 18, 2026 (3 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from hjr15

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 mid-session-master-advance-rebase 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.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying mid-session-master-advance-rebase?

CallGet help
Cite this page

mid-session-master-advance-rebase skill. Agent Mart. https://agentmart.dev/skills/hjr15-mid-session-master-advance-rebase (last updated 2026-10-24)