--- name: version-control description: | Expert guidance for Git version control, trunk-based development workflows, and GitHub best practices. Emphasizes Conventional Commits for clean history, short-lived feature branches, frequent integration, and professional collaboration patterns. Use when users need help with git commands, branching strategies, commit messages, PRs, merge conflicts, or git troubleshooting. Triggers include 'git,' 'commit,' 'branch,' 'merge,' 'rebase,' 'PR,' 'pull request,' or version control questions. allowed-tools: ["*"] --- # Version Control & Git Workflow Skill Guide users through professional version control practices using Git with trunk-based development, Conventional Commits, and GitHub integration. ## Core Philosophy **Trunk-Based Development:** - Keep main branch always deployable - Short-lived feature branches (days, not weeks) - Frequent integration to main - Small, incremental changes - Continuous integration mindset **Conventional Commits:** - Structured, semantic commit messages - Enables automated tooling (changelogs, versioning) - Clear intent and scope in history - Searchable, filterable commits **GitHub Integration:** - Pull requests for code review - Branch protection for main - CI/CD with GitHub Actions - Clear PR descriptions and discussions ## Trunk-Based Development Workflow ### The Main Branch - **Always deployable** - Main branch should always be in working state - **Protected** - Require PRs, reviews, passing CI - **Source of truth** - All branches stem from and merge back to main - **No long-lived branches** - Avoid develop, staging branches ### Feature Branch Workflow **1. Start from main:** ```bash git checkout main git pull origin main git checkout -b feat/user-authentication ``` **2. Make small, focused changes:** - One feature/fix per branch - Commit frequently with Conventional Commits - Keep branch lifespan short (1-3 days ideal) **3. Stay synchronized:** ```bash # Update from main frequently git checkout main git pull origin main git checkout feat/user-authentication git rebase main # Keep history linear ``` **4. Push and create PR:** ```bash git push -u origin feat/user-authentication # Create PR on GitHub ``` **5. After PR approval:** ```bash # Squash merge or merge commit to main # Delete feature branch immediately git checkout main git pull origin main git branch -d feat/user-authentication ``` ### Branch Naming Conventions **Pattern: `/`** Types match Conventional Commit types: - `feat/add-oauth-login` - New feature - `fix/authentication-timeout` - Bug fix - `refactor/database-queries` - Code refactoring - `docs/api-endpoints` - Documentation - `test/user-service` - Tests only - `chore/update-dependencies` - Maintenance Keep descriptions short, lowercase, hyphen-separated. ## Conventional Commits ### Format ``` ():