Guard PR worktree resets from local work - #135
Merged
Merged
Conversation
chihsuan
force-pushed
the
fix/worktree-reset-local-commits
branch
from
June 30, 2026 08:16
b8d8c58 to
b66f708
Compare
Summary: - Refuse explicit-base worktree reuse when dirty changes are present. - Refuse reset when HEAD has commits not present on any remote. - Add local and remote regression coverage. Rationale: - Hard resets during rework dispatch could silently drop committed work that had not been pushed. Tests: - mix test test/symphony_elixir/workspace_and_config_test.exs test/symphony_elixir/workspace_test.exs. - git diff --check.
chihsuan
force-pushed
the
fix/worktree-reset-local-commits
branch
from
June 30, 2026 08:24
b66f708 to
2546531
Compare
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.
Context
Explicit-base PR redispatch hard resets a reused worktree, which can drop dirty/untracked files or unpushed commits. Failing fast on that state avoids the data loss but stalls the rework and blocks it from adopting the authoritative remote head (e.g. a commit pushed to the PR via the GitHub UI).
TL;DR
PR worktree resets now snapshot local-only work to a recoverable ref, then proceed.
Summary
refs/symphony/orphaned/<sha>(acommit-treeover a throwaway index, leaving the live index/worktree untouched).|| truesubshell so a backup failure can never abort theset -euprepare script before the reset.Alternatives
checkout -fwould clobber.Test Plan
make allmix test test/symphony_elixir/workspace_and_config_test.exs test/symphony_elixir/workspace_test.exsgit diff --check origin/main...HEAD