feat(dx): add worktree:sync mise task to rebase clean worktrees on origin/main#218
Open
ClintEastman02 wants to merge 2 commits into
Open
feat(dx): add worktree:sync mise task to rebase clean worktrees on origin/main#218ClintEastman02 wants to merge 2 commits into
ClintEastman02 wants to merge 2 commits into
Conversation
…igin/main Worktrees branched from origin/main drift silently as other PRs merge, causing unnecessary conflicts at push time and CI runs against stale bases. Issue aws-samples#197. The new `mise run worktree:sync` task fetches origin/main and rebases every clean linked worktree onto it. Dirty worktrees and main itself are skipped; conflicting rebases are aborted and reported with a non-zero exit so the operator can resolve them explicitly rather than leaving a half-rebased state. Closes aws-samples#197
Contributor
|
Works as designed. I noticed that the script could be enhanced with a "detect already-merged branches" check (e.g., |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new mise task
mise run worktree:syncthat fetchesorigin/mainand rebases every clean linked worktree onto it. Implements Option A from #197.git worktree list --porcelainand rebases each linked worktreeSKIPmessagemain/master(rebase isn't the right tool for the primary branch)git rebase --abortand exits non-zero so the operator surfaces the conflict explicitly rather than leaving a half-rebased stateAlso updates
AGENTS.mdto point contributors at the new task in two places (the worktree common-mistake bullet and the Commands you can use list).Closes #197
Test plan
Tested locally with four worktree states:
origin/main→ rebased successfullyorigin/main→ no-op (rebase reports "up to date")SKIPmessage, not touchedFAILreported,git rebase --abortruns, working tree restored to pre-rebase HEAD, task exits non-zeromainworktree → skipped silentlymise tasks --alllists//:worktree:sync)