42 lines
1.1 KiB
Bash
42 lines
1.1 KiB
Bash
|
|
#!/usr/bin/env bash
|
|||
|
|
# new-feature.sh – Feature- oder Fix-Branch aus develop erstellen und pushen
|
|||
|
|
#
|
|||
|
|
# Verwendung:
|
|||
|
|
# bash .claude/scripts/new-feature.sh feature <name>
|
|||
|
|
# bash .claude/scripts/new-feature.sh fix <name>
|
|||
|
|
# bash .claude/scripts/new-feature.sh debug <name>
|
|||
|
|
|
|||
|
|
set -euo pipefail
|
|||
|
|
|
|||
|
|
TYPE="${1:-}"
|
|||
|
|
NAME="${2:-}"
|
|||
|
|
|
|||
|
|
if [[ -z "$TYPE" || -z "$NAME" ]]; then
|
|||
|
|
echo "Verwendung: bash .claude/scripts/new-feature.sh [feature|fix|debug] <name>"
|
|||
|
|
exit 1
|
|||
|
|
fi
|
|||
|
|
|
|||
|
|
case "$TYPE" in
|
|||
|
|
feature|fix|debug) ;;
|
|||
|
|
*)
|
|||
|
|
echo "Fehler: Ungültiger Typ '$TYPE'. Erlaubt: feature, fix, debug"
|
|||
|
|
exit 1
|
|||
|
|
;;
|
|||
|
|
esac
|
|||
|
|
|
|||
|
|
BRANCH="$TYPE/$NAME"
|
|||
|
|
ROOT="$(git rev-parse --show-toplevel)"
|
|||
|
|
|
|||
|
|
# Sicherstellen dass develop aktuell ist
|
|||
|
|
echo "Wechsle zu develop und aktualisiere..."
|
|||
|
|
git -C "$ROOT" checkout develop
|
|||
|
|
git -C "$ROOT" pull origin develop
|
|||
|
|
|
|||
|
|
# Branch erstellen und pushen
|
|||
|
|
echo "Erstelle Branch: $BRANCH"
|
|||
|
|
git -C "$ROOT" checkout -b "$BRANCH"
|
|||
|
|
git -C "$ROOT" push -u origin "$BRANCH"
|
|||
|
|
|
|||
|
|
echo "Fertig: Branch '$BRANCH' erstellt und gepusht."
|
|||
|
|
echo "Aktiver Branch: $(git -C "$ROOT" branch --show-current)"
|