1 line
5.0 KiB
JSON
1 line
5.0 KiB
JSON
{"content": "---\nallowed-tools: Bash(git:*)\nargument-hint: <feature-name>\ndescription: Create a new Git Flow feature branch from develop with proper naming and tracking\n---\n\n# Git Flow Feature Branch\n\nCreate new feature branch: **$ARGUMENTS**\n\n## Current Repository State\n\n- Current branch: !`git branch --show-current`\n- Git status: !`git status --porcelain`\n- Develop branch status: !`git log develop..origin/develop --oneline 2>/dev/null | head -5 || echo \"No remote tracking for develop\"`\n\n## Task\n\nCreate a Git Flow feature branch following these steps:\n\n### 1. Pre-Flight Validation\n\n- **Check git repository**: Verify we're in a valid git repository\n- **Validate feature name**: Ensure `$ARGUMENTS` is provided and follows naming conventions:\n - ✅ Valid: `user-authentication`, `payment-integration`, `dashboard-redesign`\n - ❌ Invalid: `feat1`, `My_Feature`, empty name\n- **Check for uncommitted changes**:\n - If changes exist, warn user and ask to commit/stash first\n - OR offer to stash changes automatically\n- **Verify develop branch exists**: Ensure `develop` branch is present\n\n### 2. Create Feature Branch\n\nExecute the following workflow:\n\n```bash\n# Switch to develop branch\ngit checkout develop\n\n# Pull latest changes from remote\ngit pull origin develop\n\n# Create feature branch with Git Flow naming convention\ngit checkout -b feature/$ARGUMENTS\n\n# Set up remote tracking\ngit push -u origin feature/$ARGUMENTS\n```\n\n### 3. Provide Status Report\n\nAfter successful creation, display:\n\n```\n✓ Switched to develop branch\n✓ Pulled latest changes from origin/develop\n✓ Created branch: feature/$ARGUMENTS\n✓ Set up remote tracking: origin/feature/$ARGUMENTS\n✓ Pushed branch to remote\n\n🌿 Feature Branch Ready\n\nBranch: feature/$ARGUMENTS\nBase: develop\nStatus: Clean working directory\n\n🎯 Next Steps:\n1. Start implementing your feature\n2. Make commits using conventional format:\n git commit -m \"feat: your changes\"\n3. Push changes regularly: git push\n4. When complete, use /finish to merge back to develop\n\n💡 Git Flow Tips:\n- Keep commits atomic and well-described\n- Push frequently to avoid conflicts\n- Use conventional commit format (feat:, fix:, etc.)\n- Test thoroughly before finishing\n```\n\n### 4. Error Handling\n\nHandle these scenarios gracefully:\n\n**Uncommitted Changes:**\n```\n⚠️ You have uncommitted changes:\nM src/file1.js\nM src/file2.js\n\nOptions:\n1. Commit changes first\n2. Stash changes: git stash\n3. Discard changes: git checkout .\n\nWhat would you like to do? [1/2/3]\n```\n\n**Feature Name Not Provided:**\n```\n❌ Feature name is required\n\nUsage: /feature <feature-name>\n\nExamples:\n /feature user-profile-page\n /feature api-v2-integration\n /feature payment-gateway\n\nFeature names should:\n- Be descriptive and concise\n- Use kebab-case (lowercase-with-hyphens)\n- Describe what the feature does\n```\n\n**Branch Already Exists:**\n```\n❌ Branch feature/$ARGUMENTS already exists\n\nExisting feature branches:\n feature/user-authentication\n feature/payment-gateway\n feature/$ARGUMENTS ← This one\n\nOptions:\n1. Switch to existing branch: git checkout feature/$ARGUMENTS\n2. Use a different feature name\n3. Delete existing and recreate (destructive!)\n```\n\n**Develop Behind Remote:**\n```\n⚠️ Local develop is behind origin/develop by 5 commits\n\n✓ Pulling latest changes...\n✓ Develop is now up to date\n✓ Ready to create feature branch\n```\n\n**No Develop Branch:**\n```\n❌ Develop branch not found\n\nGit Flow requires a 'develop' branch. Create it with:\n git checkout -b develop\n git push -u origin develop\n\nOr initialize Git Flow:\n git flow init\n```\n\n## Git Flow Context\n\nThis command is part of the Git Flow branching strategy:\n\n- **main**: Production-ready code (protected)\n- **develop**: Integration branch for features (protected)\n- **feature/***: New features (you are here)\n- **release/***: Release preparation\n- **hotfix/***: Emergency production fixes\n\nFeature branches:\n- Branch from: `develop`\n- Merge back to: `develop`\n- Naming convention: `feature/<descriptive-name>`\n- Lifecycle: Short to medium term\n\n## Environment Variables\n\nThis command respects:\n- `GIT_FLOW_DEVELOP_BRANCH`: Develop branch name (default: \"develop\")\n- `GIT_FLOW_PREFIX_FEATURE`: Feature prefix (default: \"feature/\")\n\n## Related Commands\n\n- `/finish` - Complete and merge feature branch to develop\n- `/flow-status` - Check current Git Flow status\n- `/release <version>` - Create release branch from develop\n- `/hotfix <name>` - Create hotfix branch from main\n\n## Best Practices\n\n**DO:**\n- ✅ Use descriptive feature names\n- ✅ Keep feature scope focused and small\n- ✅ Push to remote regularly\n- ✅ Test your changes before finishing\n- ✅ Use conventional commit messages\n\n**DON'T:**\n- ❌ Create features directly from main\n- ❌ Use generic names like \"feature1\"\n- ❌ Let feature branches live too long\n- ❌ Mix multiple unrelated features\n- ❌ Skip testing before merging\n"} |