Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问clear审计提醒

gitGit 版本控制

Agent Skill

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

总安装

412

周安装

17

GitHub Stars

38

下载量

135
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 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

简介

主要指令:

  • 始终使用提交消息编写器代理进行提交
  • 使用 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 通行证
  • 套接字通行证
  • 斯尼克警告

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

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

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 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills