Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

git-automation

БесплатноБез исполняемых скриптовНе проверен

Advanced Git operations automation including intelligent branching, commit optimization, release workflows, and repository health management

bejranondaот bejranonda★ 28 звёзд на GitHub13 установок в других каталогах

Об этом скилле

Overview

Comprehensive Git automation skill that provides intelligent repository management, advanced branching strategies, automated commit optimization, and sophisticated release workflows with continuous learning from repository patterns.

Git Repository Intelligence

Repository Analysis

# Analyze repository structure and patterns
analyze_repository() {
  local repo_path=$1

  # Repository metrics
  local total_commits=$(git rev-list --count HEAD)
  local total_branches=$(git branch -a | wc -l)
  local total_tags=$(git tag -l | wc -l)
  local repo_size=$(du -sh .git 2>/dev/null | cut -f1)

  # Activity metrics
  local recent_commits=$(git log --since="1 month ago" --oneline | wc -l)
  local active_contributors=$(git log --since="3 months ago" --format='%ae' | sort -u | wc -l)

  # Quality metrics
  local merge_conflicts=$(git log --grep="conflict" --oneline | wc -l)
  local large_files=$(git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort -nr | head -10 | wc -l)

  echo "Repository Analysis for $repo_path:"
  echo "  Total Commits: $total_commits"
  echo "  Total Branches: $total_branches"
  echo "  Total Tags: $total_tags"
  echo "  Repository Size: $repo_size"
  echo "  Recent Commits (1mo): $recent_commits"
  echo "  Active Contributors (3mo): $active_contributors"
  echo "  Merge Conflicts: $merge_conflicts"
  echo "  Large Files (>1MB): $large_files"
}

Branching Strategy Detection

# Detect current branching strategy
detect_branching_strategy() {
  local main_branch=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
  local develop_branch=$(git branch -r | grep -E "origin/develop|origin/dev" | head -1 | sed 's@origin/@@')
  local release_branches=$(git branch -r | grep -E "origin/release|origin/rel" | wc -l)
  local feature_branches=$(git branch -r | grep -E "origin/feat|origin/feature" | wc -l)

  if -n "$develop_branch" && $release_branches -gt 0; then
    echo "GitFlow"
  elif -z "$develop_branch" && $feature_branches -gt 0; then
    echo "GitHub Flow"
  elif $feature_branches -eq 0 && $release_branches -eq 0; then
    echo "Trunk-Based Development"
  else
    echo "Custom Strategy"
  fi
}

Intelligent Commit Management

Semantic Commit Analysis

# Analyze commits for semantic versioning impact
analyze_commit_impact() {
  local commit_range=$1

  # Count commit types
  local breaking_changes=$(git log --oneline $commit_range | grep -c "BREAKING\|breaking")
  local features=$(git log --oneline $commit_range | grep -c "feat:")
  local fixes=$(git log --oneline $commit_range | grep -c "fix:")
  local performance=$(git log --oneline $commit_range | grep -c "perf:")
  local refactors=$(git log --oneline $commit_range | grep -c "refactor:")

  # Determine version bump
  if $breaking_changes -gt 0; then
    echo "major ($breaking_changes breaking changes)"
  elif $features -gt 0; then
    echo "minor ($features features added)"
  else
    echo "patch ($fixes fixes, $performance improvements)"
  fi
}

# Generate intelligent commit messages
generate_commit_message() {
  local changes=$(git diff --cached --name-only)
  local commit_type=""
  local scope=""
  local description=""

  # Analyze changed files to determine commit type
  if echo "$changes" | grep -q "test\|spec"; then
    commit_type="test"
  elif echo "$changes" | grep -q "doc\|readme\|md"; then
    commit_type="docs"
  elif echo "$changes" | grep -q "package\|requirements\|setup"; then
    commit_type="chore"
  elif echo "$changes" | grep -q "\.py\|\.js\|\.ts\|\.java\|\.cpp"; then
    commit_type="feat"  # Default to feature for code changes
  fi

  # Extract scope from file paths
  scope=$(echo "$changes" | head -1 | cut -d'/' -f1)

  # Generate description from file changes
  description=$(echo "$changes" | head -3 | tr '\n' ', ' | sed 's/,$//')

  echo "$commit_type($scope): $description"
}

Automated Commit Optimization

# Optimize commit history
optimize_commit_history() {
  local target_branch=$1
  local since_date=${2:-"1 month ago"}

  # Identify fixup commits
  local fixup_commits=$(git log --since="$since_date" --oneline --grep="fixup!" --grep="squash!" | wc -l)

  if $fixup_commits -gt 0; then
    echo "Found $fixup_commits fixup/squash commits"

    # Interactive rebase to squash fixups
    local base_commit=$(git merge-base $target_branch HEAD)
    git rebase -i --autosquash $base_commit
  fi

  # Remove empty commits
  git filter-branch --commit-filter '
    if git rev-parse --verify HEAD^1 >/dev/null 2>&1 &&
       [ "$(git diff-tree --no-commit-id --root -r --name-only HEAD | wc -l)" = 0 ]; then
      skip_commit "$@";
    else
      git commit-tree "$@";
    fi
  ' HEAD~50..HEAD
}

Advanced Release Automation

Intelligent Version Bumping

# Smart version bump based on changes
Полный SKILL.md на GitHub

Установить git-automation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл git-automation?

Advanced Git operations automation including intelligent branching, commit optimization, release workflows, and repository health management

Как установить скилл git-automation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл git-automation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить git-automation с