Skip to content

Conversation

@lucasrcezimbra
Copy link

@lucasrcezimbra lucasrcezimbra commented Jan 28, 2026

Description

Add a --no-verify flag to git gtr new command that skips execution of post-create hooks.

I chose --no-verify over --no-hooks for consistency with git's convention (git commit --no-verify, git push --no-verify). However, I'm open to changing this to --no-hooks if preferred.

Motivation

Fixes #90

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Other (please describe):

Testing

Manual Testing Checklist

Tested on:

  • macOS
  • Linux (specify distro: Debian)
  • Windows (Git Bash)

Core functionality tested:

Test report: https://github.com/lucasrcezimbra/git-worktree-runner/blob/be59e39ffdac88549b66014d7a59a3ebbbb1de59/test-report.md

  • git gtr new <branch> - Create worktree
  • git gtr go <branch> - Navigate to worktree
  • git gtr editor <branch> - Open in editor (if applicable)
  • git gtr ai <branch> - Start AI tool (if applicable)
  • git gtr rm <branch> - Remove worktree
  • git gtr list - List worktrees
  • git gtr config - Configuration commands (if applicable)
  • Other commands affected by this change: git gtr new --no-verify

Test Steps

  1. Configure a post-create hook:
    git config --add gtr.hook.postCreate "echo 'Created!' > /tmp/gtr-test"
  2. Create worktree without the flag:
    ./bin/gtr new test-with-hooks
    cat /tmp/gtr-test  # Should show "Created!"
    rm /tmp/gtr-test
  3. Create worktree with --no-verify:
    ./bin/gtr new test-no-verify --no-verify
    ls /tmp/gtr-test  # Should fail - file should NOT exist
  4. Cleanup:
    ./bin/gtr rm test-with-hooks
    ./bin/gtr rm test-no-verify
    git config --unset gtr.hook.postCreate

Expected behavior: When --no-verify is passed, post-create hooks should be skipped.

Actual behavior: Works as expected. Hooks run normally without the flag, and are skipped with --no-verify.

Breaking Changes

  • This PR introduces breaking changes
  • I have discussed this in an issue first
  • Migration guide is included in documentation

Checklist

Before submitting this PR, please check:

  • I have read CONTRIBUTING.md
  • My code follows the project's style guidelines
  • I have performed manual testing on at least one platform
  • I have updated documentation (README.md, CLAUDE.md, etc.) if needed
  • My changes work on multiple platforms (or I've noted platform-specific behavior)
  • I have added/updated shell completions (if adding new commands or flags)
  • I have tested with both git gtr (production) and ./bin/gtr (development)
  • No new external dependencies are introduced (Bash + git only)
  • All existing functionality still works

License Acknowledgment

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0.

Summary by CodeRabbit

  • New Features

    • Added --no-verify flag to the git gtr new command to skip post-create hooks during worktree creation.
  • Documentation

    • Updated CLI documentation with the new flag option and added shell completion support across Bash, Fish, and Zsh shells.
  • Tests

    • Added test scenario demonstrating the new flag's behavior and cleanup.

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

Add --no-verify flag completion for Bash, Zsh, and Fish shells to support
skipping post-create hooks when creating new worktrees.
- Add --no-verify flag to README.md Options section
- Add --no-verify to automation flags table in docs/advanced-usage.md
- Add --no-verify test case to CLAUDE.md manual testing workflow
- Complete Phase 3 of --no-verify implementation plan
- Executed all 7 test cases from Phase 4 of the plan
- All tests passed successfully
- Verified default behavior, flag functionality, flag combinations
- Confirmed shell completions and help text updates
- Validated scope isolation (only affects postCreate hooks)
- Test environment cleaned up after execution

All tests PASS - feature is production-ready
The --no-verify flag implementation has been completed and fully tested.
All plan items were successfully implemented across code, completions,
and documentation. Test report confirms all 7 test cases passed.
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Walkthrough

This pull request implements the --no-verify flag for the git gtr new command, allowing users to skip post-create hook execution when creating a worktree. Changes include core flag parsing logic, shell completion updates, and documentation additions across multiple files.

Changes

Cohort / File(s) Summary
Core Implementation
bin/gtr
Added --no-verify flag parsing logic, introduced skip_hooks variable to conditionally execute post-create hooks. Hook execution is now skipped when the flag is provided. Updated help text to document the new option.
Documentation & Changelog
README.md, docs/advanced-usage.md, CLAUDE.md
Added --no-verify flag description to CLI documentation and advanced usage guide. Added test scenario demonstrating hook-skipping behavior and cleanup in test documentation.
Shell Completions
completions/_git-gtr, completions/git-gtr.fish, completions/gtr.bash
Added --no-verify flag to completion definitions across Bash, Fish, and Zsh shells with "Skip post-create hooks" description.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A flag to skip the hooks we sow,
--no-verify steals the show,
Fast worktrees now, no side effects in sight,
Like git itself, we got it right! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a --no-verify flag to skip post-create hooks in the git gtr new command.
Linked Issues check ✅ Passed The PR fully implements issue #90 requirements: adds --no-verify flag to skip post-create hooks, maintains backward compatibility, includes shell completions, and provides documentation updates.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the --no-verify flag feature: CLI flag addition, completions updates, and documentation. No unrelated modifications are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 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.

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.

Feature request: Add flag to skip hooks in git gtr new

1 participant