Repository navigation
docs(extending): add recipe for carrying changes to a new worktree - #2083
Merged
Merged
Conversation
Three tested aliases (`move-changes`, `copy-changes`, `copy-staged`) that compose `wt switch --create` with git's stash and diff plumbing so staged, unstaged, and untracked changes can follow you into a new worktree. Closes #938. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This was referenced Apr 11, 2026
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 tested recipe to the Aliases section of
docs/content/extending.mdshowing three[aliases]entries that composewt switch --createwith git's stash/diff plumbing to carry in-progress changes into a new worktree:move-changes— stashes staged + unstaged + untracked, creates the new worktree, and pops the stash with--execute. Source becomes clean.copy-changes— same push, plusgit stash apply --index --quietto restore the source before the new worktree pops. Both sides end up with identical state.copy-staged— writesgit diff --cachedto a tempfile and applies it withgit apply --indexin the new worktree, so the source is untouched and staged/unstaged overlap is handled.Each alias takes the target branch via
--var to=feature-xyz. Because an innerwt switch --createinside an alias body propagates itscdto the parent shell (#2077), they drop you in the new worktree directly.The content was worked out and tested end-to-end in the issue thread (
git status --porcelainverified on both sides for clean / staged+unstaged+untracked / untracked-only / empty-staged scenarios).Closes #938.
Test plan
cargo test --test integration test_command_pages_and_skill_files_are_in_sync— keepskills/worktrunk/reference/extending.mdin syncpre-commit run --all-files— lints