commit-commands plugin uses session working directory instead of the git repo where changes were made
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When Claude Code's primary working directory (cwd) is set to one git repository but files are edited in a different git repository (or a sibling worktree), the commit-commands:commit-push-pr and
commit-commands:commit plugins run their git commands (git status, git diff, git add, git commit) from the session cwd — not from the repository where the changes actually exist.
The result is the plugin sees an empty diff, produces an empty commit, or stages/commits from the wrong repo entirely.
What Should Happen?
The plugin should operate on the git repository where the files were modified — either by auto-detecting it from the session's recent edits, or by accepting a --workdir parameter.
Error Messages/Logs
No explicit error. The plugin silently reads git state from the wrong directory and produces an empty or incorrect commit.
Steps to Reproduce
- Open Claude Code with primary cwd set to /path/to/repo-A
- Edit files located in /path/to/repo-B (a different git repository or sibling worktree)
- Invoke the commit-commands:commit-push-pr plugin skill
- Observe: plugin runs
git statusandgit difffrom repo-A, sees no changes
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.126 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗