Skip to main content

git-preflight

Pre-commit and pre-edit git checklist — staged diff code-review, macOS case renames, remote branch sync verification. Run before committing or starting work on a feature branch.

跳到安装

来源信息

仓库
SpecterOps/skills
最近来源活动
2026年8月14日 01:16
检测到的 SKILL.md 语言
英语
星标
657
分支
72

安装方式

默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。

检查来源文件

决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。

文件资源管理器
4 个文件

正在显示 SKILL.md

SKILL.md
来源说明 · 只读预览
name
git-preflight
description
Pre-commit and pre-edit git checklist — staged diff code-review, macOS case renames, remote branch sync verification. Run before committing or starting work on a feature branch.
metadata
{"author":"GhostWorks"}
# Git Preflight Checklist Run before committing (`commit`) or before editing a feature branch (`branch`). Default (`all`) runs both. ## `branch` — Before Editing a Feature Branch Verify the local branch is in sync with remote before making any changes: ```bash git fetch origin git log --oneline HEAD..origin/$(git branch --show-current) ``` If output is non-empty, the remote is ahead — pull before editing: ```bash git pull --ff-only ``` If the branch has diverged, report to user and stop. Do not start editing on a stale branch. ## `commit` — Before Committing ### 1. Review staged diff ```bash git diff --staged ``` Check for: - **Unintended lines** — edits from before the current session that got staged with `git add` - **Debug output** — leftover print/log statements - **Secrets** — any tokens, passwords, or API keys accidentally staged If unintended changes are staged, unstage the file and re-add only the intended hunks: ```bash git restore --staged <file> git add -p <file> ``` ### 2. Check for case-rename traps (macOS) If any staged files look like case-only renames (e.g., `foo.md` → `FOO.md`), verify git actually tracked it: ```bash git status ``` On macOS (case-insensitive FS), `git mv foo.md FOO.md` is a no-op. The correct approach: ```bash git mv foo.md tmp.md && git mv tmp.md FOO.md ``` ### 3. Verify branch ```bash git branch --show-current ``` Confirm you're on the intended feature branch, not `main` or `master`. If on main/master, create a feature branch before committing unless this is intentional. ## Output Report pass/fail for each check: ``` Git Preflight — commit ✓ Staged diff reviewed — N files, no unintended changes ✓ No case-rename issues detected ✓ On branch feat/my-feature (not main) Ready to commit. ``` Or with issues: ``` Git Preflight — commit ✗ Staged diff contains lines from before current session in src/main.py → Run: git restore --staged src/main.py && git add -p src/main.py ✓ No case-rename issues detected ✓ On branch feat/my-feature Fix staged diff before committing. ```
在 GitHub 查看