From: Kai Moritz Date: Sun, 31 May 2026 19:53:23 +0000 (+0000) Subject: lib.sh: reset_branches_to_remote zeigt nur tatsächlich geänderte Branches X-Git-Tag: scripting--2026-06-04~11 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=73354ae5b239d6d23569d73f077691e1f3b75496;p=demos%2Fkafka%2Ftraining lib.sh: reset_branches_to_remote zeigt nur tatsächlich geänderte Branches Branches, bei denen lokaler Stand und origin/ bereits identisch sind, werden ohne Ausgabe übersprungen. Profitiert auch reset.sh. Co-Authored-By: Claude Sonnet 4.6 --- diff --git a/lib.sh b/lib.sh index c540626c..31bd8472 100755 --- a/lib.sh +++ b/lib.sh @@ -37,8 +37,11 @@ find_common_tag_suffixes() { # Erwartet, dass origin aktuell ist — ggf. vorher git fetch origin aufrufen. # Kehrt am Ende zu scripting zurück. reset_branches_to_remote() { - local branch + local branch local_hash remote_hash for branch in "${BRANCH_NAMES[@]}"; do + local_hash=$(git rev-parse "$branch" 2>/dev/null) || continue + remote_hash=$(git rev-parse "refs/remotes/origin/$branch" 2>/dev/null) || continue + [ "$local_hash" != "$remote_hash" ] || continue echo " $branch" git checkout -q "$branch" git reset -q --hard "origin/$branch"