git-automation
Advanced Git operations automation including intelligent branching, commit optimization, release workflows, and repository health management
What this skill does
## 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
```bash
# 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
```bash
# 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
```bash
# 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
```bash
# 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
```bash
# Smart version bump based on changes
smart_version_bump() {
local current_version=$(get_current_version)
local commit_range=$(get_last_release_range)
local version_impact=$(analyze_commit_impact "$commit_range")
echo "Current version: $current_version"
echo "Version impact: $version_impact"
case $version_impact in
major*)
local new_version=$(bump_version "$current_version" major)
;;
minor*)
local new_version=$(bump_version "$current_version" minor)
;;
patch*)
local new_version=$(bump_version "$current_version" patch)
;;
esac
echo "New version: $new_version"
update_version_files "$new_version"
}
# Update version across all files
update_version_files() {
local new_version=$1
# Common version files
local version_files=(
"package.json"
"setup.py"
"pyproject.toml"
"Cargo.toml"
"composer.json"
"pom.xml"
"__init__.py"
"version.py"
"Dockerfile"
)
for file in "${version_files[@]}"; do
if [[ -f "$file" ]]; then
case "$file" in
"package.json")
npm version $new_version --no-git-tag-version
;;
"setup.py"|"pyproject.toml")
bump2version $new_version --allow-dirty
;;
"Cargo.toml")
cargo bump $new_version
;;
*)
# Generic version update
sed -i "s/version\s*=\s*[\"'][0-9]\+\.[0-9]\+\.[0-9]\+[\"']/version = \"$new_version\"/" "$file"
;;
esac
fi
done
}
```
### Release Workflow Automation
```bash
# Complete release workflow
execute_release_workflow() {
local new_version=$1
local release_notes_file=$2
echo "Starting release workflow for v$new_version"
# 1. Pre-release validation
validate_release_readiness || exit 1
# 2. Update version files
update_version_files "$new_version"
# 3. Generate changelog
generate_changelog "$new_version" > CHANGELOG.md.tmp
cat CHANGELOG.md.tmp >> CHANGELOG.md
rm CHANGELOG.md.tmp
# 4. Commit version changes
git add .
git commit -m "chore(release): v$new_version"
# 5. Create release branch/tag
git checkout -b "release/v$new_version"
git tag -a "v$new_version" -m "Release v$new_version"
# 6. Merge to main
git checkout main
git merge "release/v$new_version" --no-ff
# 7. Push changes
git push origin main
git push origin "v$new_version"
# 8. Create GitHub release
if command -v gh >/dev/null 2>&1; then
if [[ -f "$release_notes_file" ]]; then
gh release create "v$new_version" --title "Release v$new_version" --notes-file "$release_notes_file"
else
gh release create "v$new_version" --title "Release v$new_version" --generate-notes
fi
fi
# 9. Cleanup
git branch -d "release/v$new_version"
echo "Release v$new_version completed successfully!"
}
# Pre-release validation
validate_release_readiness() {
local errors=0
# Check working directory is clean
if [[ -n $(git status --porcelain) ]]; then
echo "❌ Working directory is not cleaRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.