Neues Skript bin/git-notify.sh prüft beim interaktiven Shell-Start im Hintergrund alle Repos auf neue Remote-Commits (git fetch + count). Gibt nur eine Zeile aus wenn Updates vorhanden, sonst kein Output. Nutzer steuert Aktualisierung selbst via gitsync. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.1 KiB
Bash
Executable file
49 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# git-notify.sh — prüft beim Shell-Start ob Remote-Commits verfügbar sind.
|
|
# Läuft im Hintergrund, gibt nur eine Zeile aus wenn Updates vorhanden.
|
|
# Kein Output wenn alles aktuell ist.
|
|
|
|
BASE_DIR="${BASE_DIR:-$HOME/git-projekte}"
|
|
GITEA_BASE="https://git.motocamp.de/rene"
|
|
|
|
REPO_NAMES=(
|
|
balkonsteuerung
|
|
berechnungstabellen
|
|
claude-skills
|
|
comfy
|
|
dotfiles-rene
|
|
esp32
|
|
ki-agenten
|
|
macbook-setup
|
|
Pi_pico_2w
|
|
portainer
|
|
skripte
|
|
test
|
|
web
|
|
zellenhalter-generator
|
|
)
|
|
|
|
C_YELLOW=$'\033[33m'
|
|
C_CYAN=$'\033[36m'
|
|
C_BOLD=$'\033[1m'
|
|
C_RESET=$'\033[0m'
|
|
|
|
updates=()
|
|
|
|
for NAME in "${REPO_NAMES[@]}"; do
|
|
TARGET="$BASE_DIR/$NAME"
|
|
[ -d "$TARGET/.git" ] || continue
|
|
|
|
cd "$TARGET" || continue
|
|
git fetch --quiet 2>/dev/null || continue
|
|
|
|
behind=$(git rev-list --count "HEAD..@{u}" 2>/dev/null || echo 0)
|
|
(( behind > 0 )) && updates+=("$NAME ($behind)")
|
|
done
|
|
|
|
if (( ${#updates[@]} > 0 )); then
|
|
names=$(printf '%s, ' "${updates[@]}")
|
|
names="${names%, }"
|
|
printf "\n${C_YELLOW}📥 Git-Updates verfügbar${C_RESET} ${C_BOLD}%s${C_RESET}\n" "$names"
|
|
printf " ${C_CYAN}→ gitsync${C_RESET} zum Aktualisieren\n\n"
|
|
fi
|