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

git-workflowGit 工作流

Agent Skill

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

总安装

857

周安装

35

下载量

277
Local Agent

安装说明

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

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

请帮我安装这个 Agent Skill:git-workflow(Git 工作流)
来源仓库:https://smithery.ai
仓库路径:git-workflow
安装命令:
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。当前暂无明确安装命令,请以来源页面说明为准。

简介

git-workflow 用于查找、检索和筛选相关信息。

  • 适合在 Local Agent 中根据关键词或任务场景快速定位候选结果。
  • 可结合来源仓库和原始 README 核验具体用法。git-workflow 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 安装前建议确认权限范围和维护状态,避免触发联网或文件操作。
  • 注意是否会执行命令或访问外部资源,确保操作安全可控。

SKILL.md

Git Workflow - Professional Version Control

When to use this skill

  • Managing feature branches and branch strategies
  • Creating clear, meaningful commit messages
  • Resolving merge conflicts effectively
  • Rebasing branches to maintain clean history
  • Squashing commits before merging
  • Using interactive rebase to clean up history
  • Implementing branch naming conventions
  • Following commit message standards (Conventional Commits)
  • Managing pull requests and code reviews
  • Collaborating in team Git workflows
  • Recovering from Git mistakes (reset, revert, reflog)
  • Managing release branches and hotfixes

When to use this skill

  • Managing code changes, collaborating with teams, creating branches, handling conflicts, and maintaining clean git history.
  • When working on related tasks or features
  • During development that requires this expertise

Use when: Managing code changes, collaborating with teams, creating branches, handling conflicts, and maintaining clean git history.

Core Principles

  1. Commit Often, Push When Stable - Small, focused commits are easier to review and revert
  2. Main Branch is Sacred - Always deployable, never commit directly
  3. Clear History Tells a Story - Future developers read commit messages to understand why
  4. Review Before Sharing - Check git diff before committing

Essential Commands

Starting Work

# Update local repository
git fetch origin
git pull origin main

# Create feature branch
git checkout -b feature/user-authentication
# Or: git switch -c feature/user-authentication

# Branch naming conventions:
# feature/description  - new feature
# fix/description      - bug fix
# refactor/description - code improvement
# docs/description     - documentation

Making Changes

# Check what changed
git status                    # Overview
git diff                      # Unstaged changes
git diff --staged             # Staged changes
git diff main...HEAD          # All changes since branching

# Stage changes
git add path/to/file          # Specific file
git add path/to/directory     # Entire directory
git add -p                    # Interactive staging (recommended!)

# Commit with good message
git commit -m "feat: add user authentication endpoint

- Implement JWT token generation
- Add password hashing with bcrypt
- Create middleware for auth verification

Closes #123"

Commit Message Format

Use Conventional Commits:

<type>(<scope>): <subject>

<body>

<footer>

Types:

  • feat: New feature
  • fix: Bug fix
  • refactor: Code change that neither fixes a bug nor adds a feature
  • docs: Documentation only
  • style: Formatting, missing semicolons, etc.
  • test: Adding tests
  • chore: Maintenance tasks
  • perf: Performance improvement

Examples:

# Good commits
git commit -m "feat: add user avatar upload"
git commit -m "fix: prevent race condition in order processing"
git commit -m "refactor: extract validation logic into separate module"

# Bad commits (too vague)
git commit -m "fix stuff"        # What stuff?
git commit -m "WIP"              # Never push WIP commits
git commit -m "asdf"             # Meaningless

Viewing History

# Recent commits
git log --oneline -10

# Commits with diffs
git log -p -2

# Visual branch graph
git log --graph --oneline --all

# Find who changed a line
git blame path/to/file

# Search commit messages
git log --grep="authentication"

# Find commits by author
git log --author="alice"

Branching & Merging

# List branches
git branch                    # Local
git branch -r                 # Remote
git branch -a                 # All

# Switch branches
git checkout main
# Or: git switch main

# Merge feature branch
git checkout main
git merge feature/user-auth   # Creates merge commit
git merge --squash feature/user-auth  # Squashes into one commit

# Delete branch after merge
git branch -d feature/user-auth       # Safe delete (merged only)
git branch -D feature/user-auth       # Force delete
git push origin --delete feature/user-auth  # Delete remote

Handling Conflicts

# When merge conflict occurs:

# 1. See conflicted files
git status

# 2. Open files, resolve conflicts manually
# Look for: <<<<<<< HEAD, =======, >>>>>>> branch

# 3. Mark as resolved
git add path/to/resolved-file

# 4. Complete merge
git commit  # Will use default merge message

# Or abort merge
git merge --abort

Conflict Example:

<<<<<<< HEAD
const apiUrl = 'https://api.prod.example.com';
=======
const apiUrl = 'https://api-v2.example.com';
>>>>>>> feature/update-api

// After resolution (choose appropriate version):
const apiUrl = 'https://api-v2.example.com';

Undoing Changes

# Undo working directory changes (NOT staged)
git checkout -- path/to/file
# Or: git restore path/to/file

# Unstage file (keep changes)
git reset HEAD path/to/file
# Or: git restore --staged path/to/file

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

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

# Revert a commit (creates new commit)
git revert abc123

# Amend last commit (before pushing)
git commit --amend
git commit --amend --no-edit  # Keep message

Stashing

# Save work in progress
git stash

# Stash with message
git stash save "WIP: working on user profile"

# List stashes
git stash list

# Apply most recent stash
git stash apply

# Apply and remove from stash list
git stash pop

# Apply specific stash
git stash apply stash@{2}

# Delete stash
git stash drop stash@{0}

# Clear all stashes
git stash clear

Rebasing

# Update branch with main changes
git checkout feature/user-auth
git rebase main

# Interactive rebase (clean up history)
git rebase -i HEAD~5

# During rebase:
# - pick: keep commit
# - reword: change commit message
# - squash: combine with previous commit
# - fixup: like squash but discard message
# - drop: remove commit

# Abort rebase if things go wrong
git rebase --abort

# Continue after resolving conflicts
git rebase --continue

⚠️ Never rebase commits that have been pushed to shared branches!

Cherry-Picking

# Apply specific commit to current branch
git cherry-pick abc123

# Cherry-pick multiple commits
git cherry-pick abc123 def456

# Cherry-pick without committing (stage only)
git cherry-pick -n abc123

Workflow Patterns

Feature Branch Workflow

# 1. Create branch from main
git checkout main
git pull origin main
git checkout -b feature/new-feature

# 2. Make changes and commit
# ... work work work ...
git add .
git commit -m "feat: implement new feature"

# 3. Keep branch updated with main
git fetch origin
git rebase origin/main

# 4. Push to remote
git push origin feature/new-feature

# 5. Create pull request on GitHub/GitLab

# 6. After PR approved and merged, cleanup
git checkout main
git pull origin main
git branch -d feature/new-feature

Gitflow Workflow

# Main branches:
# - main (production)
# - develop (integration)

# Supporting branches:
# - feature/* (new features)
# - release/* (release preparation)
# - hotfix/* (urgent fixes)

# Start feature
git checkout develop
git checkout -b feature/awesome-feature

# Finish feature
git checkout develop
git merge --no-ff feature/awesome-feature
git branch -d feature/awesome-feature

# Create release
git checkout develop
git checkout -b release/1.2.0
# ... bump version, update changelog ...
git checkout main
git merge --no-ff release/1.2.0
git tag -a v1.2.0 -m "Release 1.2.0"

# Hotfix
git checkout main
git checkout -b hotfix/critical-bug
# ... fix bug ...
git checkout main
git merge --no-ff hotfix/critical-bug
git checkout develop
git merge --no-ff hotfix/critical-bug
git tag -a v1.2.1 -m "Hotfix 1.2.1"

Trunk-Based Development

# Everyone commits to main frequently
# Short-lived feature branches (<1 day)
# Feature flags for incomplete work

git checkout main
git pull origin main
git checkout -b feature/quick-change

# ... make small change ...
git commit -am "feat: add button"
git push origin feature/quick-change

# Create PR, get quick review, merge
# Delete branch immediately after merge

Git Configuration

Essential Config

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

# Editor
git config --global core.editor "code --wait"  # VS Code
# Or: vim, nano, emacs, etc.

# Default branch name
git config --global init.defaultBranch main

# Helpful aliases
git config --global alias.co checkout
git config --global alias.br branch
git config --global alias.ci commit
git config --global alias.st status
git config --global alias.unstage 'reset HEAD --'
git config --global alias.last 'log -1 HEAD'
git config --global alias.visual 'log --graph --oneline --all'

# Auto-correct typos
git config --global help.autocorrect 20

# Colorful output
git config --global color.ui auto

# Push current branch only
git config --global push.default current

# Pull with rebase by default
git config --global pull.rebase true

.gitignore

# Create global gitignore
git config --global core.excludesfile ~/.gitignore_global

# Common entries:
# OS files
.DS_Store
Thumbs.db

# Editor files
.vscode/
.idea/
*.swp
*.swo
*~

# Dependencies
node_modules/
venv/
vendor/

# Build outputs
dist/
build/
*.pyc
*.class

# Secrets
.env
.env.local
secrets.yml
*.pem

# Logs
*.log
logs/

Advanced Techniques

Git Worktrees

# Work on multiple branches simultaneously
git worktree add ../project-feature2 feature/feature2
cd ../project-feature2  # Separate directory, same repo

# List worktrees
git worktree list

# Remove worktree
git worktree remove ../project-feature2

Bisect (Find Breaking Commit)

# Binary search for bad commit
git bisect start
git bisect bad                # Current state is broken
git bisect good v1.0.0        # Last known good version

# Git checks out commit for testing
# Test manually or: git bisect run ./test.sh

git bisect good  # If test passes
git bisect bad   # If test fails

# Repeat until found
# git bisect reset to return to original state

Reflog (Safety Net)

# See all recent actions (even after reset)
git reflog

# Recover "lost" commits
git checkout abc123  # From reflog

# Undo a bad reset
git reset --hard HEAD@{2}

Best Practices

✅ Do

  • Write clear, descriptive commit messages
  • Commit logical units of change
  • Review diffs before committing (git diff --staged)
  • Pull before pushing
  • Keep commits small and focused
  • Use branches for all changes
  • Delete branches after merging

❌ Don't

  • Commit secrets or credentials
  • Commit generated files (build artifacts)
  • Commit directly to main
  • Rewrite history on shared branches
  • Create massive commits with unrelated changes
  • Use vague commit messages
  • Push broken code

Troubleshooting

Common Issues

"Detached HEAD":

# You checked out a commit directly
# To save work:
git checkout -b new-branch-name

"Merge conflict in large file":

# Use theirs or ours:
git checkout --theirs path/to/file  # Take their version
git checkout --ours path/to/file    # Keep our version
git add path/to/file

"Accidentally committed to main":

# Move commit to new branch
git branch feature/accidental
git reset --hard origin/main
git checkout feature/accidental

"Pushed sensitive data":

# Use BFG Repo Cleaner or git-filter-repo
# WARNING: Rewrites history, coordinate with team

# Then force push (⚠️ DANGEROUS)
git push --force-with-lease

Resources


Remember: Git is a time machine for your code. Use it to create checkpoints, explore alternative solutions safely, and maintain a clear history of why changes were made.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

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

平台分布

Local Agent

84.38%
按下载量换算234

安全审计

暂无安全审计结果可展示。

权限和风险

需要联网

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

安装前确认

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

来源信息

继续浏览同类 Skills