agentsclimarketplace

Git ops

Skill codingSamss/all-my-ai-needs/platforms/claude/skills/git-ops

Claude Code + Codex 双平台 AI dotfiles:统一管理 skills/agents/hooks,并一键同步到 ~/.claude 与 ~/.codex。

Install
npx -y skills add codingSamss/all-my-ai-needs --skill git-ops

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 11 stars11 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Use when Sam asks Claude Code 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.

SKILL.md

6.6 KB, as published. Nobody here has run it

Git Ops

Scope

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.

Safety Rules

Before any Git write operation:

git status --short --branch

Rules:

  • Treat existing uncommitted changes as user work unless proven otherwise.
  • Do not run destructive commands such as git reset --hard, git checkout -- <file>, git clean -fd, git push --delete, or force-push without explicit written confirmation.
  • Use git clean -fdn before any real clean operation and report what would be removed.
  • Prefer rg, git diff, git status, git branch -vv, git log, and git show-ref for inspection before acting.
  • For remote cleanup wording, say stale local remote-tracking refs or 本地 origin/* 缓存; git fetch --prune origin does not delete remote branches.

Feature Branch Naming

When Sam says "功能分支" or asks to create a feature branch, use:

feature/<YYYYMMDD>/<需求编码>_<功能简介>

Example:

feature/20260521/MR2026052182911_xiaomei

Rules:

  • The first path segment is always feature.
  • The second segment is the date as YYYYMMDD.
  • Sam usually provides the date. If the date is missing, ask before creating the branch.
  • If Sam provides MMDD only, normalize it to YYYYMMDD using the clearly applicable year from the task context. If the year is ambiguous, ask.
  • The third segment is <需求编码>_<功能简介>.
  • Do not invent a requirement code. If missing, ask.
  • Keep 功能简介 short and branch-safe. Prefer lowercase ASCII slugs such as hyde, xiaomei, rrl_auth.

Given:

需求编码: MR2026051590006
date: 0528
功能简介: hyde

Create:

feature/20260528/MR2026051590006_hyde

Create Branch

Before creating a branch:

  1. Run git status --short --branch.
  2. Check whether the base branch and target branch exist.
  3. If the worktree has unrelated changes, ask whether to use a separate worktree, stash, or keep the current state.
  4. Refresh the remote base when network access is available.

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

JetBrains DontCommit

Before git add / git commit, inspect .idea/workspace.xml if it exists:

rg -n "ChangeListManager|DontCommit|DoNotCommit" .idea/workspace.xml

Rules:

  • Files in DontCommit / DoNotCommit changelists must not be committed.
  • If such files are already staged, unstage only those files.
  • Override only if Sam explicitly asks to include them.
  • If the main worktree has DontCommit or unrelated local files, prefer a temporary git worktree for release promotion.

Commit And Push

When Sam says "提交推送吧" after implementation, treat commit and push as part of the task.

Before commit:

git status --short --branch
git diff --check

Rules:

  • Stage only intended files.
  • Keep unrelated user changes unstaged.
  • Default git commit messages to Chinese. Code identifiers, module names, commands, paths, and proper nouns may stay in English.
  • If independent topics are mixed and Sam says "拆两个", split commits by topic.
  • After push, verify branch state with git status --short --branch and, when useful, git branch -vv --list <branch>.

Release Promotion

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:

  • Inspect divergence first.
  • Explain why fast-forward is impossible.
  • Use git merge --no-ff -m "<中文合并信息>" <feature-branch> only when that matches the requested promotion.

For multi-branch promotion:

  • Keep the sequence explicit.
  • Verify each local and remote branch tip.
  • Use temporary git worktree when the main workspace has unrelated local changes.

Rename Branch

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:

  • After git branch -m, always check for stale upstream metadata.
  • Do not delete the old remote branch unless Sam explicitly asks.
  • If deleting a remote branch is requested, verify the old and new refs point to the expected content first.

Compare Branches

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.
  • Tree hash plus git diff --name-status is the most direct content-sync check.

Submodules

When a repo contains submodules or gitlinks:

  • A 160000 entry is a parent-repo pointer, not normal file content.
  • If submodule source changed, commit and push inside the submodule first, then commit the parent pointer.
  • Branch switching can leave an untracked submodule working tree on disk. Inspect it as submodule state; do not delete it as noise without confirmation.

Finish

Always report the final Git state:

  • current branch
  • start point or target branch used
  • commit hash / merge hash when created
  • push result when pushed
  • verification commands run
  • whether git status --short --branch is clean
  • skipped files, especially DontCommit / DoNotCommit

Gives 0 of the 12 instructions most pr commit review skills give

Counted across 888 of the 1,342 authors here whose files we hold, read 2026-08-06

  • use conventional commits formatin 123 of 888, across 110 files
  • keep subject line under 72 charactersin 60 of 888, across 46 files
  • delete branches after mergein 50 of 888, across 37 files
  • use imperative mood in subject linein 50 of 888, across 41 files
  • use imperative mood in commit messagesin 45 of 888
  • generate a conventional commit messagein 42 of 888
  • make atomic commitsin 37 of 888, across 25 files
  • run tests before committingin 36 of 888, across 24 files
  • run project test suite to verify clean baselinein 35 of 888, across 7 files
  • run detected project setup commandsin 34 of 888, across 6 files
  • wrap commit body at 72 charactersin 32 of 888, across 25 files
  • split unrelated changes into separate commitsin 32 of 888, across 27 files

Said here and by no other author read

  • ask before creating a branch if required details are missing
  • unstage files in DontCommit or DoNotCommit changelists
  • commit and push submodules before parent pointers
  • use fast-forward only for release promotion
  • explain why fast-forward is impossible
  • verify branch state after push

Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.