Skip to content

Comments

docs: document how to remove all merged worktrees#76

Merged
helizaga merged 3 commits intocoderabbitai:mainfrom
scarf005:patch-1
Jan 9, 2026
Merged

docs: document how to remove all merged worktrees#76
helizaga merged 3 commits intocoderabbitai:mainfrom
scarf005:patch-1

Conversation

@scarf005
Copy link
Contributor

@scarf005 scarf005 commented Jan 9, 2026

Fixes #75

git gtr clean is a popular command but docs was a bit lacking

Summary by CodeRabbit

  • Documentation
    • Added docs for a new git gtr clean subcommand to remove stale worktrees and worktrees for merged pull requests
    • Described options: --merged (requires GitHub CLI), --dry-run/-n for preview, and --yes/-y for non-interactive use
    • Included practical usage examples and notes about authentication and merged-PR detection

✏️ Tip: You can customize this high-level summary in your review settings.

@scarf005 scarf005 requested a review from NatoBoram as a code owner January 9, 2026 14:41
@coderabbitai
Copy link

coderabbitai bot commented Jan 9, 2026

Warning

Rate limit exceeded

@scarf005 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d046249 and cc691c1.

📒 Files selected for processing (1)
  • README.md

Walkthrough

Adds README documentation for a new git gtr clean subcommand documenting removal of stale worktrees and worktrees for merged PRs, options --merged, --dry-run/-n, --yes/-y, usage examples, and note that --merged requires GitHub CLI authentication.

Changes

Cohort / File(s) Summary
Documentation
README.md
Added documentation for git gtr clean [options], examples, and flags: --merged (requires gh authentication), --dry-run/-n, --yes/-y. Describes behavior: remove stale worktrees or worktrees whose PRs are merged and associated local branches.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰
I nibble notes and tidy scenes,
pruned branches where the daylight leans.
git gtr clean—a careful sweep,
dry-run first, then dreams run deep. 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: documentation updates for the git gtr clean command's functionality to remove merged worktrees.
Linked Issues check ✅ Passed The PR updates documentation for removing merged worktrees as requested in issue #75, providing guidance on the git gtr clean command and its --merged option.
Out of Scope Changes check ✅ Passed The changes are limited to README.md documentation updates directly addressing the linked issue's request for clean-up tooling guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @README.md:
- Around line 109-111: Add a new subsection "### git gtr clean [options]" in the
Commands section before "Other Commands" that documents the git gtr clean
command and the --merged flag; explain that --merged removes worktrees whose PRs
are merged by invoking the GitHub CLI (gh), list usage examples (git gtr clean,
git gtr clean --merged, git gtr clean --merged --dry-run), and note the
requirement that gh CLI must be installed and authenticated for --merged mode to
work.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1fc840e and dc0b51f.

📒 Files selected for processing (1)
  • README.md
🧰 Additional context used
📓 Path-based instructions (1)
README.md

📄 CodeRabbit inference engine (CLAUDE.md)

README.md: Update README.md with installation/setup instructions when adding a new editor adapter
Update README.md with installation instructions and use cases when adding a new AI tool adapter

Files:

  • README.md
🔇 Additional comments (1)
README.md (1)

109-111: Clarify the relationship between git gtr clean --merged and git gtr rm.

The PR objectives reference issue #75, which mentions git gtr rm --merged as the desired feature. However, the documentation added here uses git gtr clean --merged instead. Please clarify:

  • Is git gtr clean --merged the final design decision, and if so, why was clean chosen over rm?
  • Are both commands equivalent, or do they serve different purposes?
  • Should the issue #75 be updated to reflect the clean command instead of rm?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
README.md (1)

264-281: Clarify "stale" worktrees and the behavior of git gtr clean without --merged.

The documentation uses "stale worktrees" without defining the term. Additionally, the first example (git gtr clean) says it will "Remove empty directories and prune," but this is vague. Consider clarifying:

  1. What qualifies as "stale"? (Empty directories only? Worktrees with deleted branches?)
  2. How does the basic command differ from --merged?
  3. When --merged is used, does the command delete both the worktree and the branch?

The --merged option is well-documented, but the non-merged case needs better explanation for users who want to clean without GitHub integration.

💡 Suggested improvements

Consider refining the command description and examples like:

- Remove stale worktrees or worktrees with merged PRs.
+ Remove worktrees: clean up empty directories, or remove those with merged GitHub PRs.

- ```bash
- git gtr clean                                  # Remove empty directories and prune
- git gtr clean --merged                         # Remove worktrees with merged PRs
- git gtr clean --merged --dry-run               # Preview what would be removed
- git gtr clean --merged --yes                    # Non-interactive mode
- ```

+ ```bash
+ git gtr clean                                  # Remove empty worktree directories and prune
+ git gtr clean --merged                         # Remove worktrees for merged PRs (GitHub CLI required)
+ git gtr clean --merged --dry-run               # Preview which worktrees would be removed
+ git gtr clean --merged --yes                   # Remove without confirmation prompts
+ ```

- - `--merged`: Remove worktrees whose PRs are merged on GitHub

+ - `--merged`: Remove worktrees whose branches have merged PRs on GitHub (also deletes the branch)
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between dc0b51f and 50b1029.

📒 Files selected for processing (1)
  • README.md
🧰 Additional context used
📓 Path-based instructions (1)
README.md

📄 CodeRabbit inference engine (CLAUDE.md)

README.md: Update README.md with installation/setup instructions when adding a new editor adapter
Update README.md with installation instructions and use cases when adding a new AI tool adapter

Files:

  • README.md
🔇 Additional comments (1)
README.md (1)

109-111: Good introduction of the command in Quick Start.

The new example clearly introduces the --merged option alongside existing workflows. The placement and progression are effective.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In @README.md:
- Line 281: Clarify the merge criteria for the --merged option by updating the
README note to explicitly state which PRs are considered "merged" (for example,
PRs merged into the repository default branch like main) and whether
closed-but-unmerged PRs are excluded; mention that the check uses the GitHub CLI
(gh) to inspect PR merge state and give a short example sentence such as "e.g.,
PRs merged into the default branch (main)".
- Line 269: The description for the command `git gtr clean` is ambiguous; update
the README entry so it explicitly states the default behavior: that `git gtr
clean` runs `git worktree prune` to remove stale worktree records and then
deletes filesystem directories that are empty and no longer associated with any
worktree, but does not delete branches or merged worktrees unless invoked with
the `--merged` option. Mention `git gtr clean` and `--merged` by name so readers
know what happens by default and what changes when `--merged` is used.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 50b1029 and d046249.

📒 Files selected for processing (1)
  • README.md
🧰 Additional context used
📓 Path-based instructions (1)
README.md

📄 CodeRabbit inference engine (CLAUDE.md)

README.md: Update README.md with installation/setup instructions when adding a new editor adapter
Update README.md with installation instructions and use cases when adding a new AI tool adapter

Files:

  • README.md
🔇 Additional comments (1)
README.md (1)

264-282: Documentation for git gtr clean command looks good overall.

The command documentation is well-structured, follows the established pattern for other commands, includes practical examples covering different option combinations, and appropriately documents the GitHub CLI authentication requirement. The placement in the Commands section is logical and the options are clearly described.

- Clarify default behavior: git gtr clean runs 'git worktree prune' and removes empty directories
- Specify that --merged removes worktrees for branches with merged PRs and deletes branches locally
- Add explicit example: PRs merged into default branch (main)
- Mention that GitHub CLI (gh) inspects merge state
- Improve comment clarity in examples
@helizaga helizaga merged commit 7e6c608 into coderabbitai:main Jan 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auto-delete merged branches

2 participants