git-worktree-precommit-hook-flutter-failure
OfficialMake Flutter pre-commit hooks work in worktrees.
System Documentation
What problem does it solve?
Pre-commit hooks that run flutter analyze in Flutter projects fail when using git worktrees, causing commits to abort despite there being no actual code issues. The root cause is that git sets GIT_DIR to a worktree-style path during hook execution, which breaks flutter pub get invoked by flutter analyze. This Skill provides a robust workaround: unset GIT_DIR, GIT_INDEX_FILE, and GIT_WORK_TREE after performing required git operations and before flutter/dart commands.
Core Features & Use Cases
- Stabilizes pre-commit hooks in Flutter worktree workflows where pub get or analyze fails due to git env vars.
- Minimal, targeted change: introduce an unset step in the pre-commit hook to ensure consistent environment for Flutter tooling.
- Use Case: A team maintains multiple git worktrees for parallel features; enabling reliable pre-commit checks across all worktrees.
Quick Start
Update your pre-commit hook to unset GIT_DIR, GIT_INDEX_FILE, and GIT_WORK_TREE after the git operations and before flutter/dart commands.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: git-worktree-precommit-hook-flutter-failure Download link: https://github.com/divinevideo/divine-mobile/archive/main.zip#git-worktree-precommit-hook-flutter-failure Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.