#!/bin/bash
# 07_conflict_resolution.sh - יצירת קונפליקט ופתרונו

# יצירת קובץ בסיסי ב-main
echo "Hello, World!" > greet.txt
git add greet.txt
git commit -m "Add greeting"

# branch אחד משנה את הקובץ
git switch -c feature/friendly
echo "Hi there, friend!" > greet.txt
git add greet.txt
git commit -m "Make greeting friendly"

# חזרה ל-main והכנסת שינוי שונה
git switch main
echo "Greetings, traveler!" > greet.txt
git add greet.txt
git commit -m "Make greeting formal"

# ניסיון merge - יצור קונפליקט
git merge feature/friendly

# בדיקה איפה הקונפליקט
git status

# פותחים את greet.txt בעורך, רואים:
# <<<<<<< HEAD
# Greetings, traveler!
# =======
# Hi there, friend!
# >>>>>>> feature/friendly

# פותרים ידנית - בוחרים גרסה אחת או משלבים
echo "Hi traveler, greetings!" > greet.txt

# מסמנים כפתור
git add greet.txt

# סיום ה-merge
git commit

# או - ביטול המיזוג כולו
# git merge --abort
