Skip to content

feat: Add commit-ish support to worktree creation command#4

Merged
tinmancoding merged 2 commits into
tinmancoding:mainfrom
dil-atacsik:create-wt-with-commit-ish
Sep 25, 2025
Merged

feat: Add commit-ish support to worktree creation command#4
tinmancoding merged 2 commits into
tinmancoding:mainfrom
dil-atacsik:create-wt-with-commit-ish

Conversation

@dil-atacsik
Copy link
Copy Markdown
Contributor

@dil-atacsik dil-atacsik commented Aug 26, 2025

🎯 What this PR does

Adds an optional `commit-ish` argument to the `wt create` command, allowing users to specify a specific commit, branch, or tag when creating worktrees. This enhancement provides the flexibility to create worktrees at specific states while maintaining backward compatibility.

🔧 Technical Changes

  • Command Interface: Added optional `commit-ish` argument to `wt create` command
  • Core Logic: Enhanced `WorktreeOperations.createWorktree()` to handle commit-ish parameter
  • Branch Resolution: Supports commit-ish for all three branch resolution types:
    • Local branches
    • Remote branches
    • New branches
  • Method Signatures: Updated throughout the worktree operations chain

📖 Usage Examples

```bash

Create worktree from specific tag

wt create feature v1.0.0

Create worktree from specific commit hash

wt create feature a1b2c3d4e5f6789012345678901234567890abcd

Create worktree from remote branch

wt create feature origin/develop

Default behavior (unchanged)

wt create feature
```

Quality Assurance

  • Type Safety: All TypeScript compilation checks pass
  • Linting: Code follows project's ESLint rules
  • Test Coverage: 100% test coverage for new functionality
  • Backward Compatibility: All existing functionality preserved
  • Error Handling: Proper error handling and user feedback

🧪 Testing

  • Unit Tests: 8 comprehensive tests for core logic
  • CLI Tests: 10 tests for command interface
  • All tests pass: ✅ Type check, linting, and test suite

🔄 Backward Compatibility

This change is fully backward compatible. Existing usage patterns continue to work unchanged.

📚 References

Implements functionality described in Git worktree documentation"

- Add optional commit-ish argument to 'wt create' command
- Allow specifying specific commit, branch, or tag when creating worktrees
- Maintain backward compatibility for existing usage
- Support all branch resolution types (local, remote, new)
- Add comprehensive test coverage for new functionality
- Update method signatures throughout the worktree operations chain

This enhancement provides users with the flexibility to create worktrees
at specific states while maintaining the simplicity of the existing
worktree management system.
@tinmancoding tinmancoding merged commit 5df62bc into tinmancoding:main Sep 25, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants