platforms/codex/skills/git-ops/SKILL.md
Use when Sam asks Codex to create, rename, compare, commit, push, merge, promote, or clean up Git branches. Covers Sam's feature branch naming convention, safe Git pre-checks, JetBrains DontCommit handling, commit-message defaults, push and release promotion verification, branch rename upstream cleanup, branch sync comparison, and submodule/gitlink handling.
npx skillsauth add codingsamss/ai-dotfiles git-opsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill for Git operation tasks. Keep project-specific runtime, build, API, environment, and release-policy details in the repo's AGENTS.md; keep reusable Git behavior here.
Do not expand scope silently. If Sam only asks to inspect, report findings. If Sam asks to commit/push/merge, carry that operation through verification unless blocked.
Before any Git write operation:
git status --short --branch
Rules:
git reset --hard, git checkout -- <file>, git clean -fd, git push --delete, or force-push without explicit written confirmation.git clean -fdn before any real clean operation and report what would be removed.rg, git diff, git status, git branch -vv, git log, and git show-ref for inspection before acting.stale local remote-tracking refs or 本地 origin/* 缓存; git fetch --prune origin does not delete remote branches.When Sam says "功能分支" or asks to create a feature branch, use:
feature/<YYYYMMDD>/<需求编码>_<功能简介>
Example:
feature/20260521/MR2026052182911_xiaomei
Rules:
feature.YYYYMMDD.MMDD only, normalize it to YYYYMMDD using the clearly applicable year from the task context. If the year is ambiguous, ask.<需求编码>_<功能简介>.功能简介 short and branch-safe. Prefer lowercase ASCII slugs such as hyde, xiaomei, rrl_auth.Given:
需求编码: MR2026051590006
date: 0528
功能简介: hyde
Create:
feature/20260528/MR2026051590006_hyde
Before creating a branch:
git status --short --branch.Preferred feature-from-master flow:
git fetch origin master
git switch --no-track -c feature/YYYYMMDD/MRxxxx_short_desc origin/master
git status --short --branch
Use --no-track so a new feature branch does not accidentally track origin/master.
If Sam explicitly says to use local master, create from local master:
git switch --no-track -c feature/YYYYMMDD/MRxxxx_short_desc master
Before git add / git commit, inspect .idea/workspace.xml if it exists:
rg -n "ChangeListManager|DontCommit|DoNotCommit" .idea/workspace.xml
Rules:
DontCommit / DoNotCommit changelists must not be committed.git worktree for release promotion.When Sam says "提交推送吧" after implementation, treat commit and push as part of the task.
Before commit:
git status --short --branch
git diff --check
Rules:
git commit messages to Chinese. Code identifiers, module names, commands, paths, and proper nouns may stay in English.git status --short --branch and, when useful, git branch -vv --list <branch>.When Sam explicitly asks to merge/push into release/sit, release/uat, or a dated release branch, perform the full requested merge and push path unless blocked.
Default flow:
git fetch origin <target-branch>
git switch <target-branch>
git merge --ff-only <feature-branch>
git push origin <target-branch>
If --ff-only fails:
git merge --no-ff -m "<中文合并信息>" <feature-branch> only when that matches the requested promotion.For multi-branch promotion:
git worktree when the main workspace has unrelated local changes.For branch rename requests, change the visible branch identifier exactly. Do not add code edits or content merges.
Reliable flow:
git branch -m <old> <new>
git branch --unset-upstream <new>
git push -u origin <new>
git branch -vv --list <new>
git ls-remote --heads origin <new> <old>
Rules:
git branch -m, always check for stale upstream metadata.Do not judge sync from commit message shape alone. Compare content and ancestry:
git rev-list --left-right --count <left>...<right>
git rev-parse <ref>^{tree}
git diff --name-status <left>..<right>
git log --oneline --ancestry-path <left>..<right>
Notes:
release/sit may carry extra merge history while still being content-identical to release/uat or a feature branch.git diff --name-status is the most direct content-sync check.When a repo contains submodules or gitlinks:
160000 entry is a parent-repo pointer, not normal file content.Always report the final Git state:
git status --short --branch is cleanDontCommit / DoNotCommitdevelopment
Safely search MX users or groups and send Midea MX / 美信 IM messages from Codex. Use when the user asks to notify someone, send a message to a person or group, use a configured group alias, @ users, @ all, or send MX file/image messages. Read lookups need no extra authorization; every live send needs explicit user authorization for that exact target and message.
development
Use when Sam wants to collect, save, translate, or reformat official source articles/blog posts/research/product announcements into the Obsidian vault, especially requests mentioning 官方文章, 官网排版, 原始排版, 美观, 收录, 1:1, 原文1:1, or 英文中文对照1:1. Preserve the source site's information architecture and visual hierarchy rather than forcing a generic Markdown template.
development
Query Midea MX / 美信 local message cache through the MX local HTTP query service from Codex. Use when the user asks to read MX sessions, search chat history, search messages globally or inside a group/session, list recent messages, or page message history. This is read-only and does not require send authorization. Never fall back to reading SQLite or app cache files directly.
tools
MX channel output rules. Always active in MX conversations.