-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbranch
More file actions
executable file
·31 lines (24 loc) · 795 Bytes
/
branch
File metadata and controls
executable file
·31 lines (24 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
set -e
echo "===================================="
echo " 🚀 Schnell-Branch-Switcher"
echo "===================================="
echo ""
# muss in git repo laufen
git rev-parse --is-inside-work-tree >/dev/null 2>&1 || {
echo "❌ Kein Git-Repo (bitte im Repo-Ordner ausführen)"
exit 1
}
read -p "Claude-Branch: " REMOTE_BRANCH
[ -z "$REMOTE_BRANCH" ] && exit 1
# Prefix sauber entfernen + "/" im local branch entschärfen
BASE="${REMOTE_BRANCH#claude/}"
LOCAL_BRANCH="test-${BASE//\//-}"
git fetch origin
git show-ref --verify --quiet "refs/remotes/origin/$REMOTE_BRANCH" || {
echo "❌ Branch nicht gefunden"
exit 1
}
git branch -D "$LOCAL_BRANCH" 2>/dev/null || true
git checkout -b "$LOCAL_BRANCH" "origin/$REMOTE_BRANCH"
echo "✅ In $LOCAL_BRANCH gewechselt"