Structure: - publishing/ - version bumping and registry publishing - git/ - multi-repo git operations - config/ - package configuration utilities - lint/ - ESLint and code quality scripts - forgejo/ - Forgejo CI/CD automation (primary) - gitlab/ - DEPRECATED legacy GitLab scripts - migration/ - one-time migration utilities - templates/ - CI/CD template files - analysis/ - codebase analysis scripts - oneoffs/ - uncategorized one-time scripts Note: commits CLI will be merged into @ml/auto-commit-service Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
64 lines
1.5 KiB
Bash
Executable file
64 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# git-push-all.sh - Push all git repos to their remotes
|
|
#
|
|
# Usage:
|
|
# git-push-all.sh [root_path]
|
|
# git-push-all.sh --dry-run # show what would be pushed
|
|
#
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT_PATH="${1:-/var/home/lilith/Code/@packages}"
|
|
DRY_RUN=false
|
|
|
|
[[ "${1:-}" == "--dry-run" ]] && DRY_RUN=true && ROOT_PATH="${2:-/var/home/lilith/Code/@packages}"
|
|
|
|
# Colors
|
|
RED='\033[0;31m'
|
|
GREEN='\033[0;32m'
|
|
YELLOW='\033[0;33m'
|
|
BLUE='\033[0;34m'
|
|
NC='\033[0m'
|
|
|
|
echo -e "${BLUE}=== Pushing all repos ===${NC}"
|
|
echo ""
|
|
|
|
pushed=0
|
|
skipped=0
|
|
failed=0
|
|
|
|
# Find all git repos
|
|
while IFS= read -r gitdir; do
|
|
repo=$(dirname "$gitdir")
|
|
rel_path="${repo#$ROOT_PATH/}"
|
|
|
|
cd "$repo"
|
|
|
|
# Check if ahead of remote
|
|
ahead=$(git rev-list --count @{u}..HEAD 2>/dev/null || echo "0")
|
|
|
|
if [[ "$ahead" == "0" ]]; then
|
|
skipped=$((skipped + 1))
|
|
continue
|
|
fi
|
|
|
|
branch=$(git branch --show-current)
|
|
|
|
if [[ "$DRY_RUN" == "true" ]]; then
|
|
echo -e "${YELLOW}[DRY-RUN]${NC} $rel_path: would push $ahead commits to $branch"
|
|
pushed=$((pushed + 1))
|
|
else
|
|
echo -ne "${BLUE}Pushing${NC} $rel_path ($ahead commits)... "
|
|
if git push origin "$branch" 2>/dev/null; then
|
|
echo -e "${GREEN}✓${NC}"
|
|
pushed=$((pushed + 1))
|
|
else
|
|
echo -e "${RED}✗${NC}"
|
|
failed=$((failed + 1))
|
|
fi
|
|
fi
|
|
done < <(find "$ROOT_PATH" -name ".git" -type d 2>/dev/null)
|
|
|
|
echo ""
|
|
echo -e "${BLUE}Summary:${NC} ${GREEN}$pushed pushed${NC}, $skipped up-to-date, ${RED}$failed failed${NC}"
|