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

install-hooks.shscripts/

#!/bin/bash
# =============================================================================
# install-hooks.sh - 开发者初始化脚本(每人只需执行一次)
# 作用:将 post-commit hook 安装到本地 .git/hooks/
# 执行方式:bash scripts/gitflow/install-hooks.sh
# =============================================================================

set -e

REPO_ROOT=$(git rev-parse --show-toplevel)
HOOKS_DIR="${REPO_ROOT}/.git/hooks"
HOOK_SOURCE="${REPO_ROOT}/scripts/gitflow/post-commit.sh"
HOOK_TARGET="${HOOKS_DIR}/post-commit"

# 检查源文件存在
if [ ! -f "$HOOK_SOURCE" ]; then
    echo "错误:找不到 $HOOK_SOURCE"
    exit 1
fi

# 如果已有 hook,备份
if [ -f "$HOOK_TARGET" ]; then
    BACKUP="${HOOK_TARGET}.bak.$(date +%Y%m%d%H%M%S)"
    echo "已有 post-commit hook,备份至:$BACKUP"
    cp "$HOOK_TARGET" "$BACKUP"
fi

# 写入新 hook(调用脚本文件,方便后续更新不用重新 install)
cat > "$HOOK_TARGET" << 'EOF'
#!/bin/bash
# 由 install-hooks.sh 生成,调用 gitflow post-commit 逻辑
REPO_ROOT=$(git rev-parse --show-toplevel)
bash "${REPO_ROOT}/scripts/gitflow/post-commit.sh"
EOF

chmod +x "$HOOK_TARGET"

echo "✓ post-commit hook 安装完成"
echo "  路径:$HOOK_TARGET"
echo ""
echo "验证:在 $(basename $REPO_ROOT) 的任意 V*.*.* _base_* 分支上 git commit 即可触发"

scripts

add-member.sh

cleanup-merged.sh

install-hooks.sh

monthly.sh

post-commit.sh

SKILL.md

tile.json