-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgit_push.sh
More file actions
executable file
·62 lines (47 loc) · 1.32 KB
/
git_push.sh
File metadata and controls
executable file
·62 lines (47 loc) · 1.32 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
# ==============================================================================
# Git Helper Script
# File: git_push.sh
#
# Purpose:
# Adds changes, creates a commit message interactively, runs secret scan, and pushes to origin.
# ==============================================================================
set -e
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$REPO_DIR"
# Pre-Commit Secret Check
./git_precommit_secrets_check.sh || exit 1
echo "==============================="
echo " VEIN Git Push Script"
echo " Repo: $REPO_DIR"
echo "==============================="
echo
# Prüfen ob wir in einem Git Repo sind
if [ ! -d ".git" ]; then
echo "❌ Kein Git-Repository gefunden."
exit 1
fi
# Status anzeigen
echo "Aktueller Git-Status:"
git status
echo
# Prüfen ob es Änderungen gibt
if git diff --quiet && git diff --cached --quiet; then
echo "ℹ️ Keine Änderungen zum Committen."
exit 0
fi
# Commit Message abfragen
read -rp "Commit-Beschreibung eingeben: " COMMIT_MSG
if [ -z "$COMMIT_MSG" ]; then
echo "❌ Commit-Beschreibung darf nicht leer sein."
exit 1
fi
echo
echo "➡️ Dateien werden hinzugefügt..."
git add -A
echo "➡️ Commit wird erstellt..."
git commit -m "$COMMIT_MSG"
echo "➡️ Push zu origin/main..."
git push
echo
echo "✅ Push erfolgreich abgeschlossen."