{ echo -e "\e[36m┌──────────────────────────────────────────────┐\e[0m" echo -e "\e[32m 🔍 UNPUSHED COMMIT DETECTION \e[0m" echo -e "\e[36m└──────────────────────────────────────────────┘\e[0m" # Check if we are inside a git repository if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then echo -e "\n\e[31m ❌ Error: Not a git repository!\e[0m\n" exit 1 fi # Get the latest commit message last_commit=$(git log -1 --pretty=format:"%s" 2>/dev/null) if [ -z "$last_commit" ]; then echo -e "\n\e[33m ⚠️ No commits found in this branch yet.\e[0m\n" exit 1 fi echo -e "\n \e[33m📂 Last Commit:\e[0m \"$last_commit\"" echo -e " \e[35m🚀 Press [ENTER] to undo this commit (Soft Reset)...\e[0m" # Wait for literal enter key press read -r # Perform the soft reset to HEAD~1 git reset --soft HEAD~1 echo -e "\n\e[36m┌──────────────────────────────────────────────┐\e[0m" echo -e "\e[32m ✅ SUCCESS: Commit undone gently! \e[0m" echo -e " 📝 Your changes are safe in the staging area. " echo -e "\e[36m└──────────────────────────────────────────────┘\e[0m\n"}