Add command for pruning worktrees#62
Conversation
|
🎉 Build Assets are ready!
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new prune command to automatically clean up worktrees and local branches associated with merged pull requests, and adds a --delete-branch option to the remove command. The review feedback focuses on improving robustness and security, including handling potential TypeErrors when parsing PR heads, ensuring post-remove hooks run even if branch deletion fails, using Path comparisons and removeprefix for safer path and string manipulation, and appending -- to Git commands to prevent argument injection.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new prune command to clean up worktrees and local branches associated with merged pull requests, and adds a --delete-branch option to the remove command. The review feedback suggests importing Path in remove.py to avoid potential name errors, updating the git mock in test_remove.py to include list_worktrees, and using .resolve() when comparing paths in prune.py to handle path representation differences robustly.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
Adds command
prunewhich can be used to prune worktrees. It works by searching the default configured Github repository for PRs with matching head branches that have been merged. It validates head commit of each matches before prompting the user to remove it. By default it also deletes the branch.The
removecommand also has a new flag that enables optional removal of the worktree branch.