Use Codex to spawn multiple solution branches in parallel, then use Claude Code to combine them into a single optimized commit.
-
Codex generates parallel branches
- Each branch explores a different implementation/feature
- All branches fork from the same parent commit (usually master HEAD)
-
Find all branches from parent commit
git branch -a --contains <PARENT_COMMIT_SHA>
Example:
git branch -a --contains f075733To count only codex branches:
git branch -a --contains <PARENT_COMMIT_SHA> | grep -E "^\s*remotes/origin/codex/" | wc -l
-
Create consolidation branch
git checkout <PARENT_COMMIT> git checkout -b combine-all-<feature>
Note: If you have local changes (like CLAUDE.md), commit them first:
git add <files> git commit -m "Add local changes"
This commit will later be amended to include all cherry-picked changes.
-
Cherry-pick all commits
# List all codex branches with their commits for branch in $(git branch -a --contains <PARENT_COMMIT_SHA> | grep -E "^\s*remotes/origin/codex/" | sed 's/^\s*remotes\/origin\///'); do echo "=== $branch ===" git log origin/$branch --oneline -5 done # Cherry-pick in order git cherry-pick <commit1> <commit2> ... <commitN>
- Resolve conflicts by keeping all changes when appropriate
- Common conflict: multiple branches modifying the same index/menu file
-
Squash into single commit
# Reset to base commit, keeping all changes staged git reset --soft <PARENT_COMMIT_SHA> # Amend with comprehensive message (this will include local changes + all cherry-picked changes) git commit --amend -m "Add features: X, Y, Z..."
-
Push combined branch
git push -u origin <branch_name>
-
Clean up branches (after user confirmation)
# Delete all remote codex branches at once (using PowerShell on Windows/WSL) powershell.exe -Command "git push origin --delete branch1 branch2 branch3..." # Or delete individually git push origin --delete branch1 branch2... # Delete local branches git branch -D branch1 branch2...
- Parent commit: f075733
- Branches found: 10 game implementations
- Result: Single commit with all games, resolved index.html conflicts
- Commit message: "Add 10 arcade games: Chess, Hangman, RPS..."