Not in a Git Repository
This error occurs when you rungwt commands outside of a git repository.
Solution:
-
Navigate to a directory inside a git repository:
-
Verify you’re in a git repository:
-
If the directory isn’t a git repository, initialize one:
Directory Already Exists
This happens when trying to create a worktree with a name that already exists in the parent directory. Solution:-
Choose a different worktree name:
-
Or remove the existing directory first:
-
Check existing worktrees:
Merge Conflicts
This occurs when usinggwt merge and there are conflicts between branches.
Solution:
-
The merge command will fail and leave you in the main branch with conflicts:
- Resolve conflicts manually in your editor
-
Stage the resolved files:
-
Complete the merge:
-
Manually remove the worktree:
Uncommitted Changes
When creating a new worktree, GWTree detects uncommitted changes and prompts you to handle them.
-
Stash changes (recommended):
- Select “Stash changes” when prompted
- Your changes are saved and can be recovered with
git stash pop
-
Ignore and continue:
- Select “Ignore and continue”
- Changes remain in the current worktree
-
Cancel:
- Select “Cancel” to abort worktree creation
Pull/Rebase Failures
This can happen when pulling latest changes from remote fails. Common causes:- No network connection: Ensure you’re connected to the internet
- Diverged branches: Local and remote have different histories
- No remote configured: Repository doesn’t have a remote origin
Worktree Already Registered
This happens when git has a worktree registered but the directory was manually deleted. Solution:-
Prune stale worktree references:
-
Try creating the worktree again:
Editor Not Opening
Worktree created successfully but editor didn’t open
- Editor not installed: Ensure VS Code or Cursor is installed
- Command not in PATH: The editor command isn’t available
- Wrong configuration: Editor setting in config doesn’t match your setup
-
Check your editor configuration:
-
Update editor setting to one of:
code,cursor,default, ornone -
Verify the editor command works:
-
Skip editor opening with
-xflag:
Dependency Installation Failed
This happens when automatic dependency installation fails. Solution:-
Navigate to the worktree:
-
Manually install dependencies:
-
Or disable automatic installation:
Branch Name Conflicts
GWTree automatically handles branch name conflicts by appending
-1, -2, etc.- Press ESC when prompted for “Worktree & branch name:”
- Enter different names for worktree and branch
Cannot Merge with Uncommitted Changes
Thegwt merge command requires a clean working directory.
Solution:
-
Navigate to the worktree:
-
Commit your changes:
-
Or stash them:
-
Try merging again:
Node Version Issues
GWTree requires Node.js 18.0.0 or higher. Solution:-
Check your Node version:
-
Upgrade Node.js:
- Using nvm:
nvm install 18 - Using fnm:
fnm install 18 - Download from nodejs.org
- Using nvm:
Getting Help
If you encounter issues not covered here:- Check existing issues: github.com/ahmadawais/gwtree/issues
- Create a new issue with:
- Error message
- Steps to reproduce
gwt --versionoutput- Operating system