[GH-ISSUE #14] Does not work with git worktrees #10

Closed
opened 2026-02-27 19:20:53 +03:00 by kerem · 2 comments
Owner

Originally created by @bengry on GitHub (Nov 14, 2025).
Original GitHub issue: https://github.com/f/git-rewrite-commits/issues/14

When running npx git-rewrite-commits inside a git worktree, the following error is thrown:

❯ npx git-rewrite-commits --provider ollama --max-commits 1
ℹ️  Using Ollama provider at http://localhost:11434
   Make sure Ollama is running: ollama serve

🚀 Git Commit Message Rewriter with AI

Current branch: [REDACTED]

Found 1 commits to process

⚠️  WARNING: This will REWRITE your git history!
This is dangerous if you have already pushed to a remote repository.
Make sure to:
  1. Work on a separate branch
  2. Have a backup of your repository
  3. Coordinate with your team if this is a shared repository

Do you want to proceed? (y/n): y

✅ Created backup branch: backup-[REDACTED]

📝 Generating new commit messages with AI...

✖ [100.0%] Error processing 5b462592: Command failed: git diff-tree --no-commit-id -p 4b825dc642cb6eb9a060e54bf8d69288fbee4904 5b462592d2a4a954b0e61f92f370c42c487906db
spawnSync /bin/sh ENOBUFS

❌ Error: ENOTDIR: not a directory, open '<path-to-current-worktree-dir>/.git/commit-message-map.json'
Originally created by @bengry on GitHub (Nov 14, 2025). Original GitHub issue: https://github.com/f/git-rewrite-commits/issues/14 When running `npx git-rewrite-commits` inside a [git worktree](https://git-scm.com/docs/git-worktree), the following error is thrown: ```console ❯ npx git-rewrite-commits --provider ollama --max-commits 1 ℹ️ Using Ollama provider at http://localhost:11434 Make sure Ollama is running: ollama serve 🚀 Git Commit Message Rewriter with AI Current branch: [REDACTED] Found 1 commits to process ⚠️ WARNING: This will REWRITE your git history! This is dangerous if you have already pushed to a remote repository. Make sure to: 1. Work on a separate branch 2. Have a backup of your repository 3. Coordinate with your team if this is a shared repository Do you want to proceed? (y/n): y ✅ Created backup branch: backup-[REDACTED] 📝 Generating new commit messages with AI... ✖ [100.0%] Error processing 5b462592: Command failed: git diff-tree --no-commit-id -p 4b825dc642cb6eb9a060e54bf8d69288fbee4904 5b462592d2a4a954b0e61f92f370c42c487906db spawnSync /bin/sh ENOBUFS ❌ Error: ENOTDIR: not a directory, open '<path-to-current-worktree-dir>/.git/commit-message-map.json' ```
kerem closed this issue 2026-02-27 19:20:53 +03:00
Author
Owner

@f commented on GitHub (Nov 15, 2025):

Can you please retest with the new version?

<!-- gh-comment-id:3535385340 --> @f commented on GitHub (Nov 15, 2025): Can you please retest with the new version?
Author
Owner

@bengry commented on GitHub (Nov 17, 2025):

Can you please retest with the new version?

Still happens for me on v0.7.3

<!-- gh-comment-id:3541413305 --> @bengry commented on GitHub (Nov 17, 2025): > Can you please retest with the new version? Still happens for me on v0.7.3
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-rewrite-commits#10
No description provided.