- Install the package globally:
pnpm install -g . - Run the command help to verify the new command:
wt --help
- Optionally, test additional commands:
- Create a new worktree:
wt new feature/test
- List worktrees:
wt list
- Remove a worktree:
wt remove feature/test
- Create a new worktree:
- In a test repository, run:
wt new editor
- Verify that a new sibling directory named
<currentDirectoryName>-editoris created. - Confirm that the worktree is added to the Git repository and that the Cursor editor opens the new directory.
- Create a test worktree:
wt new test-branch
- Make some changes in the worktree that would prevent normal removal
- Try removing the worktree without the force flag:
This should fail if there are uncommitted changes
wt remove test-branch
- Try removing the worktree with the force flag:
This should succeed and remove the worktree regardless of its state
wt remove --force test-branch
- Verify that the worktree directory is removed and the Git worktree reference is cleaned up
- Setup a Test Worktree:
- Create a new worktree for a test branch:
wt new test-merge
- Create a new worktree for a test branch:
- Make Changes in the Test Worktree:
- Navigate to the test worktree directory, edit a file, and save your changes.
- Run the Merge Command:
- Go back to your main worktree (current branch) and execute:
wt merge test-merge
- Go back to your main worktree (current branch) and execute:
- Verify the Merge:
- Confirm that the changes from
test-mergeare merged into the current branch. - Check that the test worktree is removed.
- Confirm that the changes from
- Test with Force Flag:
- Create another test worktree:
wt new test-merge-force
- Make changes that would prevent normal removal (e.g., untracked files)
- Run the merge with force flag:
wt merge test-merge-force --force
- Verify that the merge succeeds and the worktree is forcibly removed.
- Create another test worktree:
- Push a commit to the main branch (or merge the PR) to trigger the workflow.
- Check the Actions tab in your GitHub repository to see that the "Publish to npm" workflow runs successfully.
- Verify that the package is published to npm with the expected version (0.0.0-development) without any new commits from the workflow.
- The CI workflow will not make any commits or version bumps
- Version updates should be handled manually outside of CI
- Make sure you have set up the
NPM_TOKENsecret in your GitHub repository settings
- Setup Test Worktrees:
- Create two new worktrees on branches other than main:
wt new test-branch1 wt new test-branch2
- Create two new worktrees on branches other than main:
- Execute Purge Command:
- Run the purge command:
wt purge
- Run the purge command:
- Confirmation:
- For each listed worktree, verify that the branch and path are displayed.
- When prompted, enter
yto remove a worktree or any other key to skip.
- Verification:
- After purging, run:
Ensure that only the main branch worktree remains (or those you opted not to remove).
git worktree list
- After purging, run: