360 Secure SkillHub
360 安全技能中心

Git Helper

该 Skill 封装 Git 常用操作:状态检查、暂存、按 Conventional Commits 规范提交、push/pull、rebase、查看日志与 diff、分支管理,并附带安全规则(操作前先检查状态、破坏性操作需确认、不强制推送)。复杂提交规范或冲突场景可加载 references/workflows.md。

dougchambes
dougchambes
热度 61.42
最近更新 2026-05-11 17:34:47
分类:开发依赖:代码执行 / 读写文件应用场景:DevOps / 工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add legend-git-helper
Metadata
name
git-helper
description
Git workflow automation for commits, pushes, rebases, status checks, and branch operations. Use when working with git repositories for: (1) Checking status, (2) Staging files, (3) Creating commits with conventional messages, (4) Pushing/pulling, (5) Rebasing/merging, (6) Viewing logs/diffs, or (7) Managing branches.

Git Helper

Handles all git operations through safe, consistent workflows.

Core Workflows

Status Check

Before any git operation, run git status to understand repository state.

Staging

  • git add <file> - Stage specific files
  • git add -A - Stage all changes
  • git add -p - Interactive staging (review hunks)

Committing

Use Conventional Commits format:

<type>(<scope>): <description>

[optional body]

[optional footer]

Types: feat, fix, docs, style, refactor, test, chore

Scope: Optional, usually the component or area affected

Description: Imperative present tense ("add feature" not "added feature")

Push/Pull

  • git push - Push to remote (default: current branch)
  • git pull --rebase - Fetch and rebase (preferred default)
  • git pull - Fetch and merge (when merge history needed)

Rebasing

  • git rebase -i HEAD~N - Interactive rebase last N commits
  • Always confirm branch state before rebasing
  • Never rebase shared/public branches without explicit permission

Log/Diff

  • git log --oneline -N - View last N commits
  • git diff - Unstaged changes
  • git diff --staged - Staged changes
  • git diff HEAD~N - Changes over last N commits

Safety Rules

  1. Never force push without explicit user permission
  2. Always check status before any operation
  3. Confirm destructive actions (rebase, reset, hard, force push)
  4. Stay within workspace boundaries - respect user's file access rules
  5. Pull before push when working with shared branches

When to Read references/workflows.md

Load this reference file when:

  • User needs detailed Conventional Commits specification
  • Complex rebase/merge scenarios require guidance
  • Branch strategy consultation needed
  • Conflict resolution guidance required