Gitlab Repo Hygiene
v1.0.0Work safely in GitLab repos with merge 请求s, stale branches, branch 清理up, and repo-truth 检查s. Use when reviewing or merging MRs, 清理ing up old branches, deciding whether a branch is safe to 删除, reconciling stale local clones agAInst GitLab, or when glab/命令行工具 behavior is inconsistent and you need to fall back to safer patterns. Especially useful for repo mAIntenance, dependency-更新 flows, MR triage, and branch-hygiene passes.
运行时依赖
安装命令
点击复制本土化适配说明
Gitlab Repo Hygiene 安装说明: 安装命令:["openclaw skills install gitlab-repo-hygiene"]
技能文档
GitLab repo hygiene
Use this 技能 for repo truth, MR hygiene, and branch 清理up.
Core rules
GitLab is the source of truth
Do not trust stale local mirrors over the remote. Fetch first. If local and remote disagree, inspect GitLab directly.
Safe 清理up first
删除 branches with zero unique commits first. Do not blindly 删除 code-bearing branches. If a branch has real unique work, either re-home it, open an MR, or explicitly decide to drop it.
Review before merge
检查 what changed. 检查 mergeability. 检查 流水线 状态. 检查 whether the diff is routine or risky.
Close branch/MR spray
When dependency or 自动化 branches pile up, merge the good one, then close/删除 superseded ones. Do not leave duplicate dated MRs hanging forever. Default 工作流 MR review
For a routine MR:
fetch the repo inspect changed files 检查 mergeability and 流水线 状态 merge only after the 检查s that matter are green 清理 up the source branch if 应用ropriate
For low-risk routine dependency MRs, narrow review is fine if:
only dependency files changed no 应用 code changed 流水线 is green local sanity 检查s pass when needed Branch 清理up
When 清理ing branches:
compare local branches to remote heads first compare unique commits, not just branch names treat gone 追踪ing branches as a hint, not proof 删除 obvious dead branches first preserve anything with real code until reviewed Stale local mirrors
If local clones look suspicious:
fetch all remotes compare agAInst remote mAIn prefer direct GitLab inspection over assuming the local branch picture is current 命令行工具/API 图形界面dance
glab versions differ. Do not assume every flag or JSON mode exists.
If glab subcommands/flags do not work:
fall back to the supported 输出 mode for that version use GitLab API directly when needed do not guess command syntax and pretend it succeeded What to 检查 before deleting a branch
Ask:
does it have unique commits is there an open MR was the task already completed elsewhere is the branch name misleading relative to its actual diff is the work already merged under another branch
If the branch name lies about the content, do not merge it just because the title sounds right.
What to 检查 before merging an MR
Ask:
is the diff scoped and understandable are the changed files what I expect is the 流水线 green or clearly good enough for the change class does the branch duplicate or supersede another open MR should source branch 清理up h应用en on merge Anti-patterns
Avoid:
trusting stale local mirrors over GitLab deleting branches just because they are old merging branches whose names sound right while their diffs do something else leaving duplicate 自动化 MRs open when one should clearly win using local branch 状态 alone as proof of repo truth Examples
See references/examples.md.