Files
Jev Kuznetsov 60710fab20 initial commit
2026-04-16 11:36:48 +02:00

37 lines
925 B
Bash
Executable File

#!/usr/bin/env bash
# Show branch status and full diff for commit planning.
# Usage: bash scripts/status.sh [BASE_BRANCH]
set -euo pipefail
if [[ "${1:-}" == "--help" ]]; then
echo "Usage: bash scripts/status.sh [BASE_BRANCH]"
echo ""
echo "Prints the current branch, git status, and the full diff (staged and unstaged) for commit planning."
exit 0
fi
BASE_BRANCH="${1:-main}"
CURRENT_BRANCH="$(git branch --show-current)"
echo "=== current branch ==="
echo "${CURRENT_BRANCH:-detached HEAD}"
if git rev-parse --verify "$BASE_BRANCH" >/dev/null 2>&1 && [[ -n "$CURRENT_BRANCH" && "$CURRENT_BRANCH" != "$BASE_BRANCH" ]]; then
echo ""
echo "=== commits ahead of $BASE_BRANCH ==="
git --no-pager log --oneline "$BASE_BRANCH..$CURRENT_BRANCH"
fi
echo ""
echo "=== git status ==="
git status --short --branch
echo ""
echo "=== staged diff ==="
git diff --staged
echo ""
echo "=== unstaged diff ==="
git diff