#!/bin/bash echo "=== Git Commit Timeline Analysis ===" echo "" # Check if we're in a git repository if [ ! -d ".git" ]; then echo "❌ Not in a git repository" exit 1 fi # Get all branches echo "1. Available branches:" git branch -a 2>/dev/null || echo "Could not get branches" echo "" echo "2. Remote branches:" git branch -r 2>/dev/null || echo "Could not get remote branches" echo "" echo "=== COMMIT TIMELINE ===" echo "" # Function to show commits for a branch show_branch_commits() { local branch=$1 local color=$2 echo "${color}=== $branch BRANCH ===${NC}" # Check if branch exists if git show-ref --verify --quiet refs/heads/$branch 2>/dev/null || git show-ref --verify --quiet refs/remotes/origin/$branch 2>/dev/null; then echo "Commits in $branch (oldest to newest):" echo "----------------------------------------" # Get commits with date, author, and message if git log --oneline --date=short --pretty=format:"%h %ad %an: %s" $branch 2>/dev/null; then echo "" else echo "Could not get commits for $branch" fi else echo "Branch $branch does not exist" fi echo "" } # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' # No Color # Show commits for main branch show_branch_commits "main" "$GREEN" # Show commits for master branch show_branch_commits "master" "$BLUE" # Show commits for origin/main show_branch_commits "origin/main" "$YELLOW" # Show commits for origin/master show_branch_commits "origin/master" "$RED" echo "=== COMPARISON ANALYSIS ===" echo "" # Compare main and master echo "Comparing main and master branches:" echo "-----------------------------------" # Check if branches exist and have differences if git show-ref --verify --quiet refs/heads/main 2>/dev/null && git show-ref --verify --quiet refs/heads/master 2>/dev/null; then echo "Main and master are different branches" # Show what's in main but not in master echo "" echo "Commits in main but not in master:" git log --oneline master..main 2>/dev/null || echo "Could not compare" # Show what's in master but not in main echo "" echo "Commits in master but not in main:" git log --oneline main..master 2>/dev/null || echo "Could not compare" elif git show-ref --verify --quiet refs/heads/main 2>/dev/null; then echo "Only main branch exists locally" elif git show-ref --verify --quiet refs/heads/master 2>/dev/null; then echo "Only master branch exists locally" else echo "Neither main nor master exist locally" fi echo "" echo "=== REMOTE COMPARISON ===" echo "" # Compare with remote if git show-ref --verify --quiet refs/remotes/origin/main 2>/dev/null && git show-ref --verify --quiet refs/remotes/origin/master 2>/dev/null; then echo "Remote main vs remote master:" echo "-----------------------------" # Show what's in remote main but not in remote master echo "Commits in origin/main but not in origin/master:" git log --oneline origin/master..origin/main 2>/dev/null || echo "Could not compare" # Show what's in remote master but not in remote main echo "" echo "Commits in origin/master but not in origin/main:" git log --oneline origin/main..origin/master 2>/dev/null || echo "Could not compare" fi echo "" echo "=== CURRENT STATE ===" echo "" # Show current branch echo "Current branch: $(git branch --show-current 2>/dev/null || echo 'Could not determine')" # Show last commit on current branch echo "Last commit on current branch:" git log --oneline -1 2>/dev/null || echo "Could not get last commit" # Show if there are uncommitted changes echo "" echo "Uncommitted changes:" if git status --porcelain 2>/dev/null | grep -q .; then git status --porcelain 2>/dev/null else echo "No uncommitted changes" fi echo "" echo "=== SUMMARY ===" echo "" echo "This timeline shows you:" echo "1. All commits in chronological order for each branch" echo "2. Which commits exist in one branch but not another" echo "3. What happened when you pushed commits" echo "4. Where your working daemon and OCI fixes are located" echo "" echo "Look for commits that mention:" echo "- 'daemon' or 'D-Bus' (your working fixes)" echo "- 'OCI' or 'bubblewrap' (the framework you added)" echo "- Recent dates when you remember things working"