1. ما Git؟
▼Git is a free, open-source version control system. يتتبّع كل تغيير تجريه على ملفاتك، لتتمكّن دائمًا من الرجوع إلى إصدار سابق إذا حدث خطأ.
It was created in 2005 by Linus Torvalds، وهو الشخص نفسه الذي أنشأ Linux! يُعد Git أكثر أنظمة التحكم بالإصدارات استخدامًا في العالم.
Imagine you're writing a story. Every time you finish a chapter, you take a photo (snapshot) of the whole notebook. If you make a mistake later, you can look back at any photo to see what the story looked like before. Git does the same for your code and files!
In a video game, you save your progress at certain points. If your character dies, you restart from the last save. In Git, every time you "commit," you create a save point for your project!
The name "Git" is British slang for a silly person. Linus Torvalds joked that he names his projects after himself!
2. لماذا تستخدم Git؟
▼Git solves some very common problems that every developer faces:
كان الناس يحفظون الملفات بهذه الطريقة: project_v1.zip, project_v2_final.zip, project_v2_final_REALLY_final.zip... كان الأمر فوضويًا ومربكًا!
With Git, you get:
Go back to any previous version
يمكن لكثيرين العمل على المشروع نفسه
See who changed what and when
Try new ideas without breaking things
3. تثبيت Git
▼Git works on all operating systems. Here's how to install it:
Linux (Ubuntu / Debian)
افتح الطرفية واكتب:
Windows
Download from git-scm.com and run the installer. Keep all the default settings. This gives you "Git Bash" — a special terminal for Git.
macOS
افتح الطرفية واكتب:
If Git is not installed, macOS will ask you to install it.
افتح الطرفية واكتب git --version. إذا ظهر رقم إصدار، فأنت جاهز!
4. الإعداد لأول مرة
▼Before using Git, you need to tell it who you are. This information appears in every commit you make.
--global means this setting applies to ALL your projects on this computer. You only need to do this once!
5. سير العمل في Git (المناطق الـ 3)
▼Git has 3 مناطق مهمة where your files live. Understanding these is the key to understanding Git!
Working Directory = Your room with clothes everywhere.
Staging Area = The pile of clothes you've chosen to pack.
Repository = The locked suitcase, safely stored.
git add = picking clothes from your room → pile.
git commit = putting the pile into the suitcase and locking it.
6. Essential Git Commands
▼Starting a Project
إجراء تغييرات
Viewing History
اكتب دائمًا رسائل إيداع واضحة تشرح what you changed and why. قارن بين هذه الأمثلة:
❌ "fix stuff" — vague, unhelpful
✅ "Fix login button not working on mobile" — clear and useful!
7. Branches
▼A branch is like a separate copy of your project where you can try new things without affecting the main code.
Think of a tree. The trunk is your main project (called main branch). When you want to try something new, you grow a branch. إذا نما الفرع جيدًا، يمكنك دمجه مجددًا بالجذع. وإلا فيمكنك ببساطة قطعه!
Sometimes two people change the same line in the same file. Git can't decide which version to keep — this is called a merge conflict. عليك اختيار التغييرات التي تريد الاحتفاظ بها يدويًا، ثم تسجيل النتيجة.
8. Remote Repositories & GitHub
▼So far, everything has been on your computer (محليًا). لكن ماذا لو أردت:
• Share your code with others?
• Have a backup in the cloud?
• Work on the project from another computer?
That's where remote repositories come in! Popular hosting services include GitHub, GitLab، و Codeberg (مفتوح المصدر!).
مستودع محلي
Remote Repo
While GitHub is the most popular, there are great open-source alternatives like Codeberg (codeberg.org) و Gitea that you can even host yourself!
9. Try It Out! (Interactive Terminal)
▼Type Git commands below and see what happens! Try commands like: git init, git status, git add, git commit, git log, git branch
10. لعبة المطابقة
▼Drag each Git command to its correct description!
Commands
What It Does
11. بطاقات تعليمية
▼Click each card to flip it and learn what each term means!
12. الاختبار النهائي
▼Test your knowledge! Choose the correct answer for each question.
13. مرجع Git سريع
▼Keep this handy! These are the most important Git commands you'll use: