Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

git-advancedgit 高级

Agent Skill

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

总安装

1,137

周安装

46

GitHub Stars

1,489

下载量

357
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/rohitg00/awesome-claude-code-toolkit --skill git-advanced

简介

用于查找和筛选相关信息。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 适合根据关键词快速定位候选结果。
  • 可结合任务场景使用。git-advanced 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装前建议确认权限范围和维护状态。
  • 注意是否会触发联网或命令执行。

SKILL.md

Git Advanced

Worktrees

# Create a worktree for a feature branch (avoids stashing)
git worktree add ../feature-auth feature/auth

# Create a worktree with a new branch
git worktree add ../hotfix-123 -b hotfix/123 origin/main

# List all worktrees
git worktree list

# Remove a worktree after merging
git worktree remove ../feature-auth

Worktrees let you work on multiple branches simultaneously without stashing or committing WIP. Each worktree has its own working directory but shares the same .git repository.

Bisect

# Start bisect, mark current as bad and known good commit
git bisect start
git bisect bad HEAD
git bisect good v1.5.0

# Git checks out a midpoint commit. Test it, then mark:
git bisect good   # if this commit works
git bisect bad    # if this commit is broken

# Automate with a test script
git bisect start HEAD v1.5.0
git bisect run npm test

# When done, reset
git bisect reset

Bisect performs binary search across commits to find which commit introduced a bug. Automated bisect with run is the fastest approach.

Interactive Rebase

# Rebase last 5 commits interactively
git rebase -i HEAD~5

# Common operations in the editor:
# pick   - keep commit as-is
# reword - change commit message
# edit   - stop to amend the commit
# squash - merge into previous commit, keep both messages
# fixup  - merge into previous commit, discard this message
# drop   - remove the commit entirely

# Rebase feature branch onto latest main
git fetch origin
git rebase origin/main

# Continue after resolving conflicts
git rebase --continue

# Abort if things go wrong
git rebase --abort

Git Hooks

#!/bin/sh
# .git/hooks/pre-commit

# Run linter on staged files only
STAGED_FILES=$(git diff --cached --name-only --diff-filter=d | grep -E '\.(ts|tsx|js|jsx)$')
if [ -n "$STAGED_FILES" ]; then
  npx eslint $STAGED_FILES --fix
  git add $STAGED_FILES
fi
#!/bin/sh
# .git/hooks/commit-msg

# Enforce conventional commit format
COMMIT_MSG=$(cat "$1")
PATTERN="^(feat|fix|docs|style|refactor|test|chore)(\(.+\))?: .{1,72}$"

if ! echo "$COMMIT_MSG" | head -1 | grep -qE "$PATTERN"; then
  echo "Error: Commit message must follow Conventional Commits format"
  echo "Example: feat(auth): add OAuth2 login flow"
  exit 1
fi
#!/bin/sh
# .git/hooks/pre-push

# Run tests before pushing
npm test
if [ $? -ne 0 ]; then
  echo "Tests failed. Push aborted."
  exit 1
fi

Recovery Techniques

# Undo last commit but keep changes staged
git reset --soft HEAD~1

# Recover a deleted branch using reflog
git reflog
git checkout -b recovered-branch HEAD@{3}

# Recover a file from a specific commit
git checkout abc1234 -- path/to/file.ts

# Find lost commits (dangling after reset or rebase)
git fsck --lost-found
git show <dangling-commit-sha>

# Undo a rebase
git reflog
git reset --hard HEAD@{5}  # point before rebase started

Useful Aliases

# ~/.gitconfig
[alias]
  lg = log --graph --oneline --decorate --all
  st = status -sb
  co = checkout
  unstage = reset HEAD --
  last = log -1 HEAD --stat
  branches = branch -a --sort=-committerdate
  stash-all = stash push --include-untracked
  conflicts = diff --name-only --diff-filter=U

Anti-Patterns

  • Force-pushing to shared branches without --force-with-lease
  • Rebasing commits that have already been pushed and shared
  • Committing large binary files without Git LFS
  • Using git add. without reviewing git diff --staged
  • Not using .gitignore for build artifacts, dependencies, and secrets
  • Keeping long-lived feature branches instead of merging frequently

Checklist

  • Worktrees used for parallel branch work instead of stashing
  • git bisect run automates bug-finding with a test command
  • Interactive rebase cleans up commits before merging to main
  • Pre-commit hooks run linting on staged files
  • Commit message format enforced via commit-msg hook
  • --force-with-lease used instead of --force when force-pushing
  • Reflog consulted before any destructive operation
  • .gitignore covers build outputs, dependencies, and environment files

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

33.67%
按下载量换算120

Claude

28.9%
按下载量换算103

Cursor

21.05%
按下载量换算75

Gemini CLI

10.32%
按下载量换算37

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills