Skip to main content
rule

gitflow — Cursor rule: what it does, how to install

Configures Gitflow branching standards, Conventional Commits format, and release steps for the Cursor assistant.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/gitflow.mdc
Open on GitHub

What gitflow does

The rule guides Cursor on repository branch hygiene. Both main and develop branches remain protected. Direct commits are blocked. Feature branches must stem from develop using feature/[issue-id]-descriptive-name, while critical production bug fixes branch directly from main under hotfix/vX.Y.Z.

All commits must follow the type(scope): description structure with standard types such as feat, fix, or chore. Version numbering follows Semantic Versioning rules. Merging any branch requires an approved Pull Request and green CI status checks.

Finishing a release or hotfix branch requires tagging the version on main and back-merging into develop. Without an active develop branch in your Git repository, this workflow fails immediately.

What it helps with

  • Block direct commits to protected main and develop branches
  • Enforce naming conventions for feature, release, and hotfix branches
  • Standardize commit messages with type(scope): description format
  • Follow step-by-step release and hotfix lifecycles with semantic tags

Example prompts for the agent

  • Create a feature branch for issue 42 about user profile editing
  • Prepare a release branch for version v1.2.0 from develop
  • Draft a commit message for the navigation bug fix

How to install gitflow

Manually: put the files in place

.cursor/rules/gitflow.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about gitflow

How to install gitflow in Cursor?

Place the rule contents into .cursor/rules/gitflow.mdc in your project root. It targets all project files matching the **/* pattern.

What does the gitflow rule do?

It guides the assistant through Gitflow conventions. This covers branch lifecycles, structured commit messages, and strict Pull Request reviews before merging.

What branch naming schemes are enforced?

Features use feature/[issue-id]-descriptive-name, releases use release/vX.Y.Z, and hotfixes use hotfix/vX.Y.Z. Both release and hotfix branches must be deleted after merging.

Source text

gitflow.mdc · CC0-1.0
---
description: Gitflow Workflow Rules. These rules should be applied when performing git operations.
globs: ["**/*"]
alwaysApply: false
---
# Gitflow Workflow Rules

## Main Branches

### main (or master)
- Contains production-ready code
- Never commit directly to main
- Only accepts merges from:
  - hotfix/* branches
  - release/* branches
- Must be tagged with version number after each merge

### develop
- Main development branch
- Contains latest delivered development changes
- Source branch for feature branches
- Never commit directly to develop

## Supporting Branches

### feature/*
- Branch from: develop
- Merge back into: develop
- Naming convention: feature/[issue-id]-descriptive-name
- Example: feature/123-user-authentication
- Must be up-to-date with develop before creating PR
- Delete after merge

### release/*
- Branch from: develop
- Merge back into: 
  - main
  - develop
- Naming convention: release/vX.Y.Z
- Example: release/v1.2.0
- Only bug fixes, documentation, and release-oriented tasks
- No new features
- Delete after merge

### hotfix/*
- Branch from: main
- Merge back into:
  - main
  - develop
- Naming convention: hotfix/vX.Y.Z
- Example: hotfix/v1.2.1
- Only for urgent production fixes
- Delete after merge

## Commit Messages

- Format: `type(scope): description`
- Types:
  - feat: New feature
  - fix: Bug fix
  - docs: Documentation changes
  - style: Formatting, missing semicolons, etc.
  - refactor: Code refactoring
  - test: Adding tests
  - chore: Maintenance tasks

## Version Control

### Semantic Versioning
- MAJOR version for incompatible API changes
- MINOR version for backwards-compatible functionality
- PATCH version for backwards-compatible bug fixes

## Pull Request Rules

1. All changes must go through Pull Requests
2. Required approvals: minimum 1
3. CI checks must pass
4. No direct commits to protected branches (main, develop)
5. Branch must be up to date before merging
6. Delete branch after merge

## Branch Protection Rules

### main & develop
- Require pull request reviews
- Require status checks to pass
- Require branches to be up to date
- Include administrators in restrictions
- No force pushes
- No deletions

## Release Process

1. Create release branch from develop
2. Bump version numbers
3. Fix any release-specific issues
4. Create PR to main
5. After merge to main:
   - Tag release
   - Merge back to develop
   - Delete release branch

## Hotfix Process

1. Create hotfix branch from main
2. Fix the issue
3. Bump patch version
4. Create PR to main
5. After merge to main:
   - Tag release
   - Merge back to develop
   - Delete hotfix branch

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for Git and GitHub →

From the same set210

go-servemux-rest-api-cursorrules-prompt-file A Cursor rule that points the assistant at Go REST APIs built with net/http and the ServeMux router from Go 1.22. ★ 41,024repo stars go-backend-scalability-cursorrules-prompt-file Shapes Cursor responses for scalable Go backends by enforcing planning steps, architectural trade-offs, and final summaries. ★ 41,024repo stars github-cursorrules-prompt-file-instructions This Cursor rule guides code work toward readable, maintainable code with clear names, focused functions, and useful comments. ★ 41,024repo stars github-code-quality-cursorrules-prompt-file A set of guardrails for the Cursor agent: check facts before asserting them, skip apologies and recaps, change one file at a time. ★ 41,024repo stars git-conventional-commit-messages This Cursor rule shapes Git commit messages around Conventional Commits. Use it when an agent needs consistent types, scopes, bodies, and footers. ★ 41,024repo stars gherkin-style-testing-cursorrules-prompt-file A Cursor rule that turns technical test scripts and manual cases into Gherkin scenarios written in plain business language. ★ 41,024repo stars gamemaker-gml Guides Cursor with GameMaker Language conventions for objects, scripts, and rooms. Keeps GML projects performant and prevents common memory leaks. ★ 41,024repo stars fortran A Cursor rule for modern Fortran practices covering modules, types, arrays, builds, and tests. Use it when working on scientific Fortran code. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor