CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

yes-or-no/gitlab-commitflow

Use when setting up or installing the automated GitLab git workflow in a project, including branch versioning, monthly tags, auto-merge to develop, and branch cleanup.

Quality

82%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files

cleanup-merged.shscripts/

#!/bin/bash
# =============================================================================
# cleanup-merged.sh - 清理已合入 master 的子版本分支(GitLab CI 调用)
# 触发时机:有提交合并到 master 时
# 作用:删除所有已完全合并到 master 的 V{x.y.z}.{n}_{username} 分支
# =============================================================================

set -e

echo "[cleanup] 开始清理已合入 master 的子版本分支..."

git fetch --tags --prune origin
git fetch origin master

# 获取所有远端子版本分支(格式:V2.0.0.3_liwanchun)
# 子版本分支特征:四段版本号 + underscore + username
MERGED_BRANCHES=$(git branch -r --merged origin/master \
    | grep -E 'origin/V[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+_' \
    | sed 's|.*origin/||' \
    | tr -d ' ')

if [ -z "$MERGED_BRANCHES" ]; then
    echo "[cleanup] 没有需要清理的子版本分支"
    exit 0
fi

echo "[cleanup] 发现以下已合入 master 的子版本分支:"
echo "$MERGED_BRANCHES"

# 逐一删除
while IFS= read -r BRANCH; do
    [ -z "$BRANCH" ] && continue
    echo "[cleanup] 删除:$BRANCH"
    git push origin --delete "$BRANCH" \
        && echo "[cleanup] ✓ $BRANCH" \
        || echo "[cleanup] 警告:删除 $BRANCH 失败,跳过"
done <<< "$MERGED_BRANCHES"

echo "[cleanup] 清理完成 ✓"

scripts

add-member.sh

cleanup-merged.sh

install-hooks.sh

monthly.sh

post-commit.sh

SKILL.md

tile.json