Git Workflow Command
Automates git version control workflows including smart branch creation, conventional commit messages, interactive staging, and PR template generation. Follows Git Flow or GitHub Flow conventions with configurable defaults.
Command
/git
Description
Automates common git workflow operations with best practices baked in. Handles branch creation with naming conventions, generates conventional commit messages from diffs, and creates well-structured pull request descriptions.
Behavior
Subcommands
/git branch <description>
Creates a properly named branch from the base branch.
# Input /git branch add user authentication # Actions git fetch origin git checkout -b feat/add-user-authentication origin/main # Branch naming conventions: # feat/ -- New features # fix/ -- Bug fixes # chore/ -- Maintenance tasks # docs/ -- Documentation # refactor/ -- Code refactoring # test/ -- Adding tests
/git commit
Analyzes staged changes and generates a conventional commit message.
# Steps: 1. Run `git diff --cached --stat` to see what's staged 2. Run `git diff --cached` to see the actual changes 3. Determine the commit type from the changes: - feat: New functionality - fix: Bug fix - refactor: Code restructuring - test: Adding/updating tests - docs: Documentation changes - chore: Build, CI, dependencies - style: Formatting, whitespace - perf: Performance improvements 4. Generate a conventional commit message: feat(auth): add JWT token refresh endpoint - Add POST /api/auth/refresh for token rotation - Implement refresh token validation with Redis - Add 7-day expiry for refresh tokens 5. Present the message for approval before committing
/git pr
Generates a pull request with a comprehensive description.
# Steps: 1. Compare current branch against base (main/develop) 2. Analyze all commits in the branch 3. Generate PR title and description 4. Create the PR using gh cli: gh pr create --title "feat(auth): add JWT refresh tokens" --body "..."
/git sync
Syncs the current branch with the latest from base.
git fetch origin git rebase origin/main # If conflicts: help resolve them
Output Format
Commit Message Template
<type>(<scope>): <short description>
<body - what and why, not how>
<footer - breaking changes, issue references>
PR Description Template
## Summary - What this PR does and why ## Changes - List of specific changes ## Testing - How to test these changes ## Screenshots (if applicable)
Examples
# Create a feature branch /git branch user profile page # Generate commit message for staged changes /git commit # Create a PR for current branch /git pr # Sync with main /git sync
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Git Commit Message Generator
Generates well-structured conventional commit messages by analyzing staged changes. Follows Conventional Commits spec with scope detection.
React Component Scaffolder
Scaffolds a complete React component with TypeScript types, Tailwind styles, Storybook stories, and unit tests. Follows project conventions automatically.
CI/CD Pipeline Generator
Generates GitHub Actions workflows for CI/CD including linting, testing, building, and deploying. Detects project stack automatically.