Branches, bei denen lokaler Stand und origin/<branch> bereits identisch
sind, werden ohne Ausgabe übersprungen. Profitiert auch reset.sh.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# 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"