Git分支名称验证器
根据Git命名约定验证Git分支名称
### Git分支名称验证器
此工具根据Git的命名约定和最佳实践验证Git分支名称。
**Git分支命名规则:**
- 不能包含:`~ ^ : 空格 制表符 换行符 ? * [ \`
- 不能以`/`开头或结尾
- 不能有连续的斜杠`//`
- 不能以`.lock`结尾
- 不能包含`..`或`@{`
- 最大长度(通常为255个字符以保持文件系统兼容性)
- 不能是保留的分支名称(HEAD、main、master)
**常见分支命名约定:**
- **feature/** - 新功能
- **bugfix/** - 错误修复
- **hotfix/** - 紧急生产修复
- **release/** - 发布准备
- **develop/** - 开发分支
- **test/** - 测试分支
- **docs/** - 文档更新
- **refactor/** - 代码重构
**有效名称示例:**
- `feature/user-authentication`
- `bugfix/login-error`
- `hotfix/security-patch-001`
- `release/v1.2.3`
**无效名称示例:**
- `feature user auth`(包含空格)
- `feature//double-slash`(连续斜杠)
- `.lock-branch`(以点开头)
- `feature/.lock`(以.lock结尾)
**使用场景:**
- 创建前验证分支名称
- 强制团队命名约定
- 分支命名的预提交钩子
- CI/CD管道验证
- 代码审查自动化
API 文档
请求端点
POST /zh/api/tools/git-branch-validator
请求参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| branchName | text | 是 | - |
| allowCustomPrefixes | checkbox | 否 | Allow branch names without standard prefixes |
| enforceConvention | checkbox | 否 | Require branch names to follow naming conventions |
| reservedNames | text | 否 | Branch names that are reserved (comma-separated) |
| maxLength | number | 否 | Maximum length for branch names (filesystem compatibility) |
| allowedPrefixes | text | 否 | Valid branch name prefixes (comma-separated, end with /) |
响应格式
{
"key": {...},
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}
JSON数据:
JSON数据
AI MCP 文档
将此工具添加到您的 MCP 服务器配置中:
{
"mcpServers": {
"elysiatools-git-branch-validator": {
"name": "git-branch-validator",
"description": "根据Git命名约定验证Git分支名称",
"baseUrl": "https://elysiatools.com/mcp/sse?toolId=git-branch-validator",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}
你可以串联多个工具,比如:`https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`,最多20个。
如果遇见问题,请联系我们:[email protected]