Skip to content

Commit 12582d4

Browse files
authored
Merge pull request #157 from ycc-im/feature-update-branch-naming-rules
refactor: 更新分支命名规则移除数字开头要求
2 parents 22cd24d + 7ba505f commit 12582d4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

scripts/pre-commit-check.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@ echo -e "${YELLOW}📋 当前分支: $CURRENT_BRANCH${NC}"
2020

2121
if [ "$CURRENT_BRANCH" = "main" ]; then
2222
echo -e "${RED}❌ 错误:不能在 main 分支直接提交代码${NC}"
23-
echo -e "${YELLOW}💡 请创建功能分支:git checkout -b [###-task-description]${NC}"
23+
echo -e "${YELLOW}💡 请创建功能分支:git checkout -b [feature-bugfix-description]${NC}"
2424
exit 1
2525
fi
2626

2727
# 2. 检查分支命名规范
28-
if [[ ! "$CURRENT_BRANCH" =~ ^[0-9]+-.+$ ]]; then
29-
echo -e "${YELLOW}⚠️ 警告:分支名称建议遵循 [###-task-description] 格式${NC}"
28+
if [[ ! "$CURRENT_BRANCH" =~ ^[a-z0-9-]+-[a-z0-9-]+$ ]]; then
29+
echo -e "${YELLOW}⚠️ 警告:分支名称建议遵循 [feature-bugfix-description] 格式${NC}"
3030
echo -e "${YELLOW} 当前分支: $CURRENT_BRANCH${NC}"
31-
echo -e "${YELLOW} 建议格式: 123-feature-description${NC}"
31+
echo -e "${YELLOW} 建议格式: feature-description 或 bug-fix-description${NC}"
32+
echo -e "${YELLOW} 示例: feature-user-authentication, docs-update-guide${NC}"
3233

3334
read -p "是否继续提交?(y/N): " -n 1 -r
3435
echo

test-file.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
test content

0 commit comments

Comments
 (0)