managing-forks
Manages parallel conversation branches using git worktrees. Use when you want to explore multiple solution approaches simultaneously, need to try different implementations, or want to checkpoint your current conversation state before branching into alternative paths.
$ 설치
git clone https://github.com/mcfearsome/fork-yeah ~/.claude/skills/fork-yeah// tip: Run this command in your terminal to install the skill
name: managing-forks description: Manages parallel conversation branches using git worktrees. Use when you want to explore multiple solution approaches simultaneously, need to try different implementations, or want to checkpoint your current conversation state before branching into alternative paths.
Managing Forks - Conversation Branching for Claude Code
This skill enables you to create and manage parallel conversation branches (forks) using git worktrees. Each fork is an independent workspace where you can explore different approaches to solving a problem.
When to Use This Skill
Use fork management when:
- The user wants to try multiple implementation approaches in parallel
- You need to explore different solutions without losing your current progress
- The user asks to "fork" the conversation or try alternatives
- Working on a feature and want to experiment with different designs
- The user wants to checkpoint the current state before making major changes
Core Commands
Creating Forks
Basic Fork Creation:
src/fork_create.sh <number>
Creates N parallel fork branches from the current conversation checkpoint.
Example:
src/fork_create.sh 3
Creates 3 parallel branches, each with its own git worktree.
Fork with Target Branch:
src/fork_create.sh <number> --target <branch-name>
Creates N forks that all target a specific branch (useful for feature development).
Example:
src/fork_create.sh 3 --target feature-auth
Creates 3 forks from and targeting the feature-auth branch. All forks will merge back to this branch.
Listing Forks
src/fork_list.sh
Shows all active fork branches with their metadata, creation time, status, and worktree paths.
Viewing Fork Hierarchy
src/fork_tree.sh
Displays a visual tree representation of all forks and their parent-child relationships. Useful for understanding nested fork structures.
Switching Between Forks
src/fork_switch.sh <fork-id>
Switches the working environment to a different fork branch.
Example:
src/fork_switch.sh fork-1730678901-a1b2c3d4-2
Checking Fork Status
src/fork_status.sh
Shows the current fork's status, including git status, worktree information, and fork metadata.
Merging Forks
src/fork_merge.sh <source-fork-id>
Merges changes from another fork branch into the current branch.
Example:
src/fork_merge.sh fork-1730678901-a1b2c3d4-1
Deleting Forks
src/fork_delete.sh <fork-id>
Deletes a fork branch, its worktree, and associated metadata. Prompts for confirmation.
Example:
src/fork_delete.sh fork-1730678901-a1b2c3d4-3
Workflow Examples
Example 1: Exploring Multiple Implementation Approaches
User asks: "I want to try implementing this feature using both REST and GraphQL approaches"
Response workflow:
- Create 2 forks:
src/fork_create.sh 2 --target feature-api - In fork-1: Implement using REST
- In fork-2: Implement using GraphQL
- User evaluates both approaches
- Merge the preferred approach back to feature-api
Example 2: Trying Different Design Patterns
User asks: "Let's explore both MVC and Clean Architecture for this"
Response workflow:
- Ensure current work is committed
- Create 2 forks:
src/fork_create.sh 2 --target feature-refactor - Switch to fork-1: Implement MVC pattern
- Switch to fork-2: Implement Clean Architecture
- User compares both implementations
- Merge chosen pattern back
Example 3: Nested Forks for Sub-Experiments
User asks: "In the GraphQL approach, let's try two different schema designs"
Response workflow:
- Switch to the GraphQL fork
- Create nested forks:
src/fork_create.sh 2 --target graphql-schema - Implement different schemas in each nested fork
- Merge best schema back to GraphQL fork
- Eventually merge GraphQL fork to main feature branch
Best Practices
Before Creating Forks
-
Commit current work: Ensure git working directory is clean
git add . && git commit -m "checkpoint before forking" -
Check you're in a git repository:
git status -
Plan your forks: Think about how many parallel approaches you need
During Fork Work
- Stay organized: Use descriptive commit messages in each fork
- Document differences: Note why each approach differs
- Test independently: Each fork should be tested on its own
- Use fork status: Regularly check
src/fork_status.shto see where you are
After Fork Work
- Evaluate results: Compare implementations across forks
- Merge carefully: Use
src/fork_merge.shto combine best elements - Clean up: Delete unused forks with
src/fork_delete.sh - Document decisions: Note why you chose one approach over another
Technical Details
What Happens When You Create a Fork
- Git worktree creation: Each fork gets an isolated git worktree
- Checkpoint saving: Current conversation state is saved to JSON
- Branch creation: New git branch created for the fork
- Metadata storage: Fork information stored in
~/.claude-code/forks/ - Terminal session: If tmux is available, creates dedicated session
Fork Data Structure
~/.claude-code/forks/
├── fork-xxx-1/
│ ├── checkpoint.json # Conversation state
│ ├── metadata.json # Fork metadata
│ ├── worktree/ # Git worktree
│ └── launch.sh # Launcher script
├── fork-xxx-2/
│ └── ...
└── .fork-groups.json # Fork group relationships
Metadata Fields
Each fork stores:
fork_id: Unique identifierparent_id: Parent fork (for nested forks)target_branch: Target branch for merging (if specified)branch_number: Position in fork grouptotal_branches: Total forks in groupworktree_path: Path to git worktreestatus: active/archivedcreated_at: ISO timestamp
Error Handling
Common Issues
"Not in a git repository"
- Solution: Navigate to a git repository before creating forks
"Worktree already exists"
- Solution: Run
git worktree pruneto clean up stale worktrees
"Fork not found"
- Solution: Run
src/fork_list.shto see available forks
"Cannot create worktree"
- Solution: Ensure uncommitted changes are committed or stashed
Recovery
If forks become corrupted:
- List all worktrees:
git worktree list - Prune stale worktrees:
git worktree prune - Clean fork data:
rm -rf ~/.claude-code/forks/<bad-fork-id>
Limitations
- Maximum 10 forks can be created at once (configurable)
- Fork IDs are auto-generated and not human-readable
- Worktrees must be on the same filesystem
- Each fork requires disk space for its worktree
Integration with Terminal Multiplexing
tmux Mode (Recommended)
When tmux is installed:
- Each fork gets a dedicated tmux session
- Easy switching with
tmux attach -t fork-<id> - Multiple panes can be created in each session
Fallback Modes
When tmux is not available:
- macOS: Generates iTerm2/Terminal.app launcher scripts
- Linux: Creates shell launcher scripts
- Basic: Simple directory switching
Configuration
User configuration is stored in ~/.config/fork-yeah/config.yaml:
terminal:
mode: auto # auto, tmux, macos, linux, basic
fork:
max_forks: 10
auto_checkpoint: true
display:
use_colors: true
tree_ascii: true
Tips for Effective Fork Usage
- Communicate clearly: Tell the user which fork you're working in
- Use target branches: Always specify
--targetfor feature work - Keep forks focused: Each fork should explore one specific approach
- Document as you go: Add commit messages explaining your choices
- Merge incrementally: Don't wait until the end to merge good ideas
- Visualize often: Use
src/fork_tree.shto stay oriented
Related Documentation
- Full user guide:
README.md - Troubleshooting:
docs/TROUBLESHOOTING.md - Marketplace info:
MARKETPLACE.md - Configuration reference:
config/config.yaml
