Token导航 LogoToken导航

Agent Skill · 研究检索

git(Git 版本控制)

git 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

git 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描有提醒项,按安装量在研究检索类的 73,675 个 Skill 里排第 58,594。

总安装 412周安装 17GitHub Stars 38下载 135核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:git(Git 版本控制)
来源仓库:https://github.com/lanej/dotfiles
仓库路径:skills/git
安装命令:
npx skills add https://github.com/lanej/dotfiles --skill git
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/lanej/dotfiles --skill git

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

主要指令: 始终使用提交消息编写器代理进行提交 使用 gh CLI 进行 GitHub 操作 遵循分支命名约定 保持提交的原子性和清晰性 切勿在提交消息中包含 AI 归属 小心破坏性操作 最常见的命令: git 状态 - 检查状态 git checkout -b <分支> - 新分行 gh 公关创建 - 创建公关 git pull --rebase - 保持更新 gh pr 合并--squash - 合并公关 每周安装量 17 号 存储库 Lanej/点文件 GitHub 之星 38 第一次看到 2026 年 1 月 24 日 安全审计 Gen Agent Trust Hub 通行证 套接字通行证 斯尼克警告

来源仓库内路径:skills/git

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/lanej/dotfiles --skill git;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

git 怎么安装?

在终端执行 npx skills add https://github.com/lanej/dotfiles --skill git。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

git 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

git 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

git 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

git 用的人多吗?

公开数据是累计安装 412 次,近一周安装 17 次,下载 135 次,GitHub 38 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

git 安全吗?

第三方扫描有提醒项,说明存在需要人工确认的行为。安装前请打开源码看清它读了什么、联网到哪里。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
git

Git 版本控制 · 本页

41238操作浏览器MIT有提醒

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Git and GitHub Workflow Skill

You are a Git and GitHub workflow specialist. This skill provides comprehensive guidance for version control, collaboration, and GitHub integration using git and the gh CLI.

Core Principles

Commit Messages

CRITICAL: ALL commits must use the git-commit-message-writer agent. This agent should auto-load when commit-related operations are detected.

Agent Auto-Loading: The git-commit-message-writer agent loads automatically when:

  • User requests to "commit", "create a commit", or "commit changes"
  • The system needs to generate a commit message
  • Git commit operations are being performed

Quick commands available:

  • /git:commit [context] - Create a commit using the git-commit-message-writer agent
  • /git:worktree <branch> - Create a git worktree with automatic naming

Commit message format (enforced by agent):

  • Commitizen conventional format: <type>(<scope>): <subject>
  • Professional, human-written style
  • Subject line: Maximum 50 characters
  • NO AI attribution: Never include "Generated with Claude Code" or "Co-Authored-By: Claude"
  • Follow project conventions
  • Clear, descriptive, focused on the "why" not just the "what"

GitHub Access

Use gh CLI for all GitHub operations:

  • Issues
  • Pull requests
  • Releases
  • Repository management
  • API access

Git Fundamentals

Repository Setup

# Initialize new repository
git init

# Clone existing repository
git clone <url>
git clone <url> <directory>

# Clone with specific branch
git clone -b <branch> <url>

# Clone with depth (shallow clone)
git clone --depth 1 <url>

Basic Workflow

# Check status
git status

# View changes
git diff
git diff --staged
git diff <file>

# Stage changes
git add <file>
git add .
git add -p  # Interactive staging

# Commit changes
git commit -m "message"
# NOTE: Use commit message writer agent instead

# Push changes
git push
git push origin <branch>
git push -u origin <branch>  # Set upstream

# Pull changes
git pull
git pull --rebase  # Rebase instead of merge

Branch Management

# List branches
git branch
git branch -a  # Include remote branches
git branch -r  # Remote branches only

# Create branch
git branch <name>
git checkout -b <name>  # Create and switch
git switch -c <name>    # Modern alternative

# Switch branches
git checkout <branch>
git switch <branch>     # Modern alternative

# Delete branch
git branch -d <branch>   # Safe delete
git branch -D <branch>   # Force delete

# Delete remote branch
git push origin --delete <branch>

# Rename branch
git branch -m <old-name> <new-name>
git branch -m <new-name>  # Rename current branch

Viewing History

# View commit log
git log
git log --oneline
git log --graph --oneline --all
git log -p  # Show patches
git log --follow <file>  # Follow file history

# View specific commits
git show <commit>
git show <commit>:<file>

# Search commits
git log --grep="pattern"
git log --author="name"
git log --since="2 weeks ago"

Undoing Changes

# Discard working directory changes
git checkout -- <file>
git restore <file>  # Modern alternative

# Unstage changes
git reset HEAD <file>
git restore --staged <file>  # Modern alternative

# Undo last commit (keep changes)
git reset --soft HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1

# Amend last commit
git commit --amend
# NOTE: Only use --amend when:
# 1. User explicitly requested amend OR
# 2. Adding edits from pre-commit hook

# Revert commit (creates new commit)
git revert <commit>

Stashing

# Stash changes
git stash
git stash save "description"

# List stashes
git stash list

# Apply stash
git stash apply
git stash apply stash@{n}

# Apply and remove stash
git stash pop

# Drop stash
git stash drop stash@{n}

# Clear all stashes
git stash clear

Remote Management

# List remotes
git remote -v

# Add remote
git remote add <name> <url>

# Change remote URL
git remote set-url <name> <url>

# Remove remote
git remote remove <name>

# Fetch from remote
git fetch
git fetch <remote>
git fetch --all

# Prune deleted remote branches
git remote prune origin
git fetch --prune

Advanced Git Operations

Rebasing

# Rebase current branch
git rebase <base-branch>
git rebase main

# Interactive rebase
git rebase -i HEAD~3  # Last 3 commits
git rebase -i <commit>

# Continue/abort rebase
git rebase --continue
git rebase --abort

# Rebase with autosquash
git commit --fixup <commit>
git rebase -i --autosquash <base>

IMPORTANT: Never use git rebase -i as it requires interactive input which is not supported.

Merging

# Merge branch into current branch
git merge <branch>

# Merge without fast-forward
git merge --no-ff <branch>

# Merge with squash
git merge --squash <branch>

# Abort merge
git merge --abort

Cherry-picking

# Cherry-pick commit
git cherry-pick <commit>

# Cherry-pick multiple commits
git cherry-pick <commit1> <commit2>

# Cherry-pick range
git cherry-pick <start>..<end>

Tags

# List tags
git tag

# Create tag
git tag <name>
git tag -a <name> -m "message"  # Annotated tag

# Push tags
git push origin <tag>
git push origin --tags  # Push all tags

# Delete tag
git tag -d <name>
git push origin --delete <name>

GitHub CLI (gh)

Authentication

# Login to GitHub
gh auth login

# Check auth status
gh auth status

# Logout
gh auth logout

Pull Requests

# Create PR
gh pr create
gh pr create --title "Title" --body "Description"
gh pr create --draft
gh pr create --base develop --head feature-branch

# Using heredoc for body (recommended)
gh pr create --title "Feature: Add new thing" --body "$(cat <<'EOF'
## Summary
- Added new feature
- Fixed related bug

## Test plan
- [ ] Run unit tests
- [ ] Test manually

EOF
)"

# List PRs
gh pr list
gh pr list --state open
gh pr list --state closed
gh pr list --author @me

# View PR
gh pr view
gh pr view 123
gh pr view --web  # Open in browser

# Check PR status
gh pr checks
gh pr checks 123

# Review PR
gh pr review
gh pr review 123 --approve
gh pr review 123 --request-changes --body "Please fix X"
gh pr review 123 --comment --body "Looks good!"

# Checkout PR
gh pr checkout 123

# Merge PR
gh pr merge
gh pr merge 123
gh pr merge 123 --squash
gh pr merge 123 --merge
gh pr merge 123 --rebase

# Close/reopen PR
gh pr close 123
gh pr reopen 123

# Comment on PR
gh pr comment 123 --body "Comment text"

# Edit PR
gh pr edit 123 --title "New title"
gh pr edit 123 --body "New description"
gh pr edit 123 --add-label bug

Issues

# Create issue
gh issue create
gh issue create --title "Title" --body "Description"
gh issue create --label bug --label priority

# List issues
gh issue list
gh issue list --state open
gh issue list --assignee @me
gh issue list --label bug

# View issue
gh issue view 123
gh issue view 123 --web

# Edit issue
gh issue edit 123 --title "New title"
gh issue edit 123 --add-label bug
gh issue edit 123 --add-assignee @me

# Close/reopen issue
gh issue close 123
gh issue reopen 123

# Comment on issue
gh issue comment 123 --body "Comment text"

Repository Management

# Create repository
gh repo create
gh repo create my-repo --public
gh repo create my-repo --private
gh repo create my-repo --clone

# Clone repository
gh repo clone owner/repo
gh repo clone owner/repo directory

# Fork repository
gh repo fork
gh repo fork owner/repo
gh repo fork --clone

# View repository
gh repo view
gh repo view owner/repo
gh repo view --web

# List repositories
gh repo list
gh repo list owner

# Archive repository
gh repo archive owner/repo

Workflow Management

# List workflows
gh workflow list

# View workflow
gh workflow view
gh workflow view <workflow-id>

# Run workflow
gh workflow run <workflow>
gh workflow run <workflow> --ref branch-name

# List workflow runs
gh run list
gh run list --workflow=<workflow>

# View run details
gh run view
gh run view <run-id>

# Watch run
gh run watch <run-id>

# Re-run workflow
gh run rerun <run-id>

GitHub API Access

# Make API request
gh api <endpoint>

# Get repository info
gh api repos/owner/repo

# Get PR comments
gh api repos/owner/repo/pulls/123/comments

# POST request
gh api repos/owner/repo/issues --field title="Title" --field body="Body"

# With jq for JSON processing
gh api repos/owner/repo | jq '.stargazers_count'

Complete Workflows

Workflow 1: Feature Development

# 1. Update main branch
git checkout main
git pull

# 2. Create feature branch
git checkout -b feature/new-thing

# 3. Make changes
# ... edit files ...

# 4. Stage and commit
git add .
# Use commit message writer agent for commit

# 5. Push to remote
git push -u origin feature/new-thing

# 6. Create PR
gh pr create --title "Add new feature" --body "Description"

# 7. Address review feedback
# ... make changes ...
git add .
# Use commit message writer agent
git push

# 8. Merge PR (when approved)
gh pr merge --squash

Workflow 2: Fix Bug in Main

# 1. Create hotfix branch
git checkout main
git pull
git checkout -b hotfix/critical-bug

# 2. Fix the bug
# ... edit files ...

# 3. Commit and push
git add .
# Use commit message writer agent
git push -u origin hotfix/critical-bug

# 4. Create urgent PR
gh pr create --title "Fix: Critical bug" --body "Fixes #123"

# 5. Fast-track merge
gh pr merge --merge  # Keep commit history for hotfix

Workflow 3: Update Branch with Main

# 1. Fetch latest changes
git fetch origin

# 2. Rebase on main (preferred)
git rebase origin/main

# Or merge main (alternative)
git merge origin/main

# 3. Resolve conflicts if any
# ... fix conflicts ...
git add .
git rebase --continue  # If rebasing
# Or: git commit if merging

# 4. Push (force push if rebased)
git push --force-with-lease

Workflow 4: Review and Test PR

# 1. Checkout PR
gh pr checkout 123

# 2. Run tests
# ... test commands ...

# 3. Leave review
gh pr review --approve --body "LGTM! Tests pass."

# Or request changes
gh pr review --request-changes --body "Please fix X"

# 4. Return to your branch
git checkout feature/my-work

Workflow 5: Clean Up After Merge

# 1. Switch to main
git checkout main

# 2. Pull latest
git pull

# 3. Delete local branch
git branch -d feature/old-feature

# 4. Delete remote branch (if not auto-deleted)
git push origin --delete feature/old-feature

# 5. Prune deleted remote branches
git fetch --prune

Workflow 6: Release Management

# 1. Create release tag
git tag -a v1.0.0 -m "Release v1.0.0"
git push origin v1.0.0

# 2. Create GitHub release
gh release create v1.0.0 --title "v1.0.0" --notes "Release notes"

# With release assets
gh release create v1.0.0 --title "v1.0.0" dist/*.tar.gz

# 3. List releases
gh release list

# 4. View release
gh release view v1.0.0

Best Practices

Branch Naming

Use descriptive, categorized names:

  • feature/user-authentication
  • fix/login-bug
  • hotfix/critical-security-issue
  • refactor/cleanup-api
  • docs/update-readme
  • test/add-integration-tests

Commit Guidelines

  1. Use commit message writer agent for all commits
  2. Make atomic commits: One logical change per commit
  3. Write clear messages: Explain why, not just what
  4. Reference issues: Include issue numbers when relevant
  5. Keep commits clean: Avoid "WIP" or "fix typo" in main history

Pull Request Practices

  1. Keep PRs focused: One feature/fix per PR
  2. Write good descriptions: Explain what, why, and how to test
  3. Update regularly: Keep branch up to date with base
  4. Respond promptly: Address review comments quickly
  5. Use draft PRs: For work-in-progress feedback

Git Configuration

# Set user info
git config --global user.name "Your Name"
git config --global user.email "you@example.com"

# Set default branch name
git config --global init.defaultBranch main

# Set pull strategy
git config --global pull.rebase true

# Enable helpful colors
git config --global color.ui auto

# Set default editor
git config --global core.editor vim

Common Patterns

Pattern 1: Quick Fix on Current Branch

git add <fixed-files>
# Use commit message writer agent
git push

Pattern 2: Sync Fork with Upstream

# Add upstream remote (once)
git remote add upstream <original-repo-url>

# Fetch and merge upstream changes
git fetch upstream
git checkout main
git merge upstream/main
git push origin main

Pattern 3: Squash Commits Before Merge

# Interactive rebase to squash (locally)
git rebase -i HEAD~3

# Or use PR squash merge (preferred)
gh pr merge --squash

Pattern 4: Find Who Changed a Line

# Blame file
git blame <file>
git blame -L 10,20 <file>  # Specific lines

# With gh
gh api repos/owner/repo/commits?path=<file> | jq '.[0]'

Pattern 5: Bisect to Find Bug

# Start bisect
git bisect start
git bisect bad  # Current commit is bad
git bisect good <commit>  # Known good commit

# Test each commit git presents
# ... run tests ...
git bisect good  # or bad

# When found
git bisect reset

Troubleshooting

Issue: Merge Conflicts

# 1. See conflicted files
git status

# 2. Resolve conflicts in each file
# ... edit files ...

# 3. Mark as resolved
git add <resolved-files>

# 4. Continue operation
git rebase --continue  # If rebasing
git commit             # If merging

Issue: Accidentally Committed to Wrong Branch

# 1. Create new branch from current state
git branch correct-branch

# 2. Reset current branch
git reset --hard HEAD~1

# 3. Switch to correct branch
git checkout correct-branch

Issue: Pushed Sensitive Data

# 1. Remove from history
git filter-branch --tree-filter 'rm -f <file>' HEAD

# Or use BFG Repo-Cleaner (better)
# bfg --delete-files <file>

# 2. Force push (coordinate with team!)
git push --force

# 3. Rotate any exposed secrets immediately

Issue: Need to Change Last Commit

# If not pushed yet
git commit --amend

# If already pushed (requires force push)
git commit --amend
git push --force-with-lease

WARNING: Only amend when:

  1. User explicitly requested amend OR
  2. Adding edits from pre-commit hook

Always check authorship before amending:

git log -1 --format='%an %ae'

Issue: PR Has Conflicts

# Option 1: Rebase on base branch
git fetch origin
git rebase origin/main
git push --force-with-lease

# Option 2: Merge base branch
git fetch origin
git merge origin/main
git push

# Option 3: Use gh CLI
gh pr update-branch 123

Git Safety Rules

  1. Never force push to main/master: Warn user if requested
  2. Never skip hooks: Don't use --no-verify unless explicitly requested
  3. Never run destructive commands: Without user confirmation
  4. Always check before amending: Verify authorship and push status
  5. Use --force-with-lease: Instead of --force when needed

Integration with Commit Message Writer

After validation and before committing:

# After all changes are ready
git add .
git status  # Review what will be committed
git diff --staged  # Review actual changes

# Then request commit using commit message writer agent
# Agent will:
# 1. Analyze changes
# 2. Draft professional commit message
# 3. Create commit with proper format
# 4. NO AI attribution (per CLAUDE.md)

Quick Reference

# Status and info
git status
git log --oneline
git diff

# Branches
git checkout -b <branch>
git push -u origin <branch>
git branch -d <branch>

# Commits
git add .
# (use commit message writer)
git push

# Pull requests
gh pr create
gh pr list
gh pr checkout 123
gh pr merge --squash

# Issues
gh issue create
gh issue list
gh issue view 123

# Sync
git pull --rebase
git fetch --prune

# Cleanup
git branch -d <branch>
git push origin --delete <branch>

Summary

Primary directives:

  1. Always use commit message writer agent for commits
  2. Use gh CLI for GitHub operations
  3. Follow branch naming conventions
  4. Keep commits atomic and clear
  5. Never include AI attribution in commit messages
  6. Be careful with destructive operations

Most common commands:

  • git status - Check state
  • git checkout -b <branch> - New branch
  • gh pr create - Create PR
  • git pull --rebase - Stay updated
  • gh pr merge --squash - Merge PR

平台分布

Claude Code

30.96%
按下载量换算42

Antigravity

24.71%
按下载量换算33

OpenCode

16.13%
按下载量换算22

Codex

11.44%
按下载量换算15

Gemini CLI

7.64%
按下载量换算10

windsurf

3.25%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills