Rebase Main
Update main, rebase the current work branch, and preserve all local work. Do
not commit or push unless separately authorized.
Establish And Safeguard
- Read
AGENTS.md.
- Record branch, HEAD, upstream, worktrees, in-progress Git operations, staged,
unstaged, untracked, and relevant ignored files with content fingerprints.
- Stop if detached, currently on
main, another operation is active, or main
is checked out elsewhere and cannot be updated safely.
- Default to
origin/main; derive another target only from repository evidence.
- If dirty, create one named stash with
--include-untracked, never --all.
Confirm the tracked and untracked worktree is clean. Preserve ignored secrets
and environment files in place.
The stash is a recovery point. Do not drop it until restoration is exact.
Update And Rebase
- Fetch
origin main.
- Before switching, verify no recorded ignored/local path collides with a path
tracked by the destination. Use
git checkout --no-overwrite-ignore for
guarded transitions.
- Check out
main and run git merge --ff-only origin/main. Stop on divergence;
never reset or create a merge commit to conceal it.
- Confirm local
main and origin/main are identical.
- Check out the recorded work branch with the same collision guard.
- Run
git rebase origin/main.
- Resolve each conflict by inspecting base, new-main, and work-branch intent.
Preserve compatible changes and regenerate derived files through their tools.
Never apply blanket ours/theirs resolution.
Never use git reset --hard, git checkout --, git clean, or destructive
recovery shortcuts.
Restore And Verify
- Apply the named stash with its index.
- Resolve restoration conflicts carefully. Keep the stash while any mismatch
remains.
- Compare staged, unstaged, untracked, and ignored fingerprints to the initial
snapshot.
- Drop only the named stash after exact restoration.
- Run
git status, git diff --check, and affected lightweight checks.
- Report old/new main and branch heads plus restored working-tree state.
If the work branch was published, explain that rewritten history needs a later
git push --force-with-lease; do not perform it without explicit authorization.
1---2name: rebase-main-33description: Safely update local main from origin/main, rebase the current flutter_calendar_carousel work branch, resolve conflicts without losing staged, unstaged, untracked, ignored, or generated work, and restore the original working-tree state. Use when asked to pull main, rebase onto main, update a branch, or fix a stuck rebase.4---56# Rebase Main78Update `main`, rebase the current work branch, and preserve all local work. Do9not commit or push unless separately authorized.1011## Establish And Safeguard12131. Read `AGENTS.md`.142. Record branch, HEAD, upstream, worktrees, in-progress Git operations, staged,15 unstaged, untracked, and relevant ignored files with content fingerprints.163. Stop if detached, currently on `main`, another operation is active, or `main`17 is checked out elsewhere and cannot be updated safely.184. Default to `origin/main`; derive another target only from repository evidence.195. If dirty, create one named stash with `--include-untracked`, never `--all`.20 Confirm the tracked and untracked worktree is clean. Preserve ignored secrets21 and environment files in place.2223The stash is a recovery point. Do not drop it until restoration is exact.2425## Update And Rebase26271. Fetch `origin main`.282. Before switching, verify no recorded ignored/local path collides with a path29 tracked by the destination. Use `git checkout --no-overwrite-ignore` for30 guarded transitions.313. Check out `main` and run `git merge --ff-only origin/main`. Stop on divergence;32 never reset or create a merge commit to conceal it.334. Confirm local `main` and `origin/main` are identical.345. Check out the recorded work branch with the same collision guard.356. Run `git rebase origin/main`.367. Resolve each conflict by inspecting base, new-main, and work-branch intent.37 Preserve compatible changes and regenerate derived files through their tools.38 Never apply blanket ours/theirs resolution.3940Never use `git reset --hard`, `git checkout --`, `git clean`, or destructive41recovery shortcuts.4243## Restore And Verify44451. Apply the named stash with its index.462. Resolve restoration conflicts carefully. Keep the stash while any mismatch47 remains.483. Compare staged, unstaged, untracked, and ignored fingerprints to the initial49 snapshot.504. Drop only the named stash after exact restoration.515. Run `git status`, `git diff --check`, and affected lightweight checks.526. Report old/new main and branch heads plus restored working-tree state.5354If the work branch was published, explain that rewritten history needs a later55`git push --force-with-lease`; do not perform it without explicit authorization.