fix: gstack-upgrade uses ff-only merge before the hard reset#1033
fix: gstack-upgrade uses ff-only merge before the hard reset#1033chaotix345 wants to merge 1 commit intogarrytan:mainfrom
Conversation
The upgrade flow uses `git reset --hard origin/main` to advance HEAD. This trips destructive-command blockers (Claude Code PreToolUse hooks, pre-commit wrappers, /careful, /guard) and can abort auto-upgrades mid-flow. Switch to `git merge --ff-only origin/main` as the primary path. Falls back to the old behavior if fast-forward fails (divergent history, local commits). Clean global installs never hit the destructive flag. Also switches `git stash` to `git stash push --include-untracked -m "pre-upgrade-<date>"` so untracked build artifacts (.bak/, compiled binaries) don't block the merge, and the stash is self-describing. Tested on Windows 11 with a Claude Code PreToolUse guard that blocks destructive git operations. Upgraded from v0.16.2.0 to v0.18.1.0 cleanly via the ff-only path, setup regenerated customizations as expected.
|
Hit an edge case today that this PR's ff-only path doesn't fully cover, logging for context (not a blocker for merge). Environment: Windows 11, Git for Windows default ( What happened:
Workaround I used: renamed What I tried that doesn't work: detecting the CRLF-only case inside the upgrade flow with a pre-stash Possible follow-up that should actually work — no expectation you pick this up, just throwing it out:
Happy to open a separate PR for the |
Problem
gstack-upgradecallsgit reset --hard origin/mainas its advance-HEAD step. This trips destructive-command blockers: Claude Code PreToolUse hooks, pre-commit wrappers,/careful,/guard, and similar safety tools commonly flag the hard reset as destructive.Hit this today on Windows 11 with
auto_upgrade: trueand a Claude Code guard hook that blocks destructive git operations. Upgrade aborted mid-flow; had to manually work around the block.Fix
Try
git merge --ff-only origin/mainfirst. Falls back to the old behavior if fast-forward fails (divergent history, local commits on the skills repo).Also switches
git stashtogit stash push --include-untracked -m "pre-upgrade-<date>"so untracked build artifacts (.bak/, compiled.exebinaries from prior runs) don't block the merge, and the stash is self-describing for anyone inspecting it later.Why this is safe
merge --ff-onlysucceeds, identical end state to the hard reset, no destructive flag ever fires.git stash push --include-untrackedabove.No behavior change for the success path, just a less destructive primary command.
Testing
Ran on Windows 11 with a Claude Code PreToolUse guard that blocks destructive git operations. Upgraded from v0.16.2.0 to v0.18.1.0 cleanly via the ff-only path. Setup regenerated customizations as expected.
Note
This PR only touches
gstack-upgrade/SKILL.md.tmpl. The generatedgstack-upgrade/SKILL.mdwill pick up the change on the nextbun run gen:skill-docsor CI regen, so maintainer can regen as part of merge or leave it to the next templated build.