#!/bin/bash
# 08_remote_push_pull.sh - עבודה עם שרת מרוחק

# שכפול מאגר קיים
git clone https://github.com/user/repo.git
cd repo

# בדיקת ה-remotes
git remote -v

# הוספת remote נוסף (לדוגמה upstream של fork)
git remote add upstream https://github.com/original/repo.git
git remote -v

# הורדת שינויים בלי merge
git fetch origin
git fetch --all

# pull = fetch + merge
git pull
git pull origin main

# pull עם rebase במקום merge
git pull --rebase

# יצירת branch חדש ודחיפתו לראשונה
git switch -c feature/new-page
echo "page content" > page.html
git add page.html
git commit -m "Add new page"

# הדחיפה הראשונה דורשת -u (set upstream)
git push -u origin feature/new-page

# דחיפות הבאות
git push

# מחיקת branch מרוחק
git push origin --delete feature/new-page

# דחיפה כפויה (מסוכן! - בטוח יותר עם --force-with-lease)
# git push --force-with-lease
