#!/bin/bash
# 10_stash_workflow.sh - שמירת שינויים זמנית עם stash

# התחלת עבודה על פיצ'ר
git switch -c feature/dashboard
echo "dashboard wip" > dashboard.js
echo "more wip" > chart.js

# פתאום צריך לעבוד על משהו דחוף
git stash push -m "WIP dashboard"

# בדיקה - הקבצים נעלמו מ-working directory
git status

# רשימת ה-stashes
git stash list

# פרטי ה-stash
git stash show
git stash show -p

# מעבר ל-main לטיפול בבאג דחוף
git switch main
git switch -c hotfix/critical-bug

# ...תיקון הבאג...
echo "fix" > fix.js
git add fix.js
git commit -m "Fix critical bug"

# חזרה לפיצ'ר המקורי
git switch feature/dashboard

# שחזור ה-stash + מחיקה מהרשימה
git stash pop

# או שחזור בלי מחיקה
# git stash apply

# מחיקה ידנית של stash
# git stash drop stash@{0}

# מחיקת כל ה-stashes
# git stash clear
