انتقل إلى المحتوى
أمين أبوزيد
BEG-046

التحكم في الإصدارات (Version control)

  • 8 درس
  • 83 دقيقة قراءة
  • 3 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • المستودع (Repository)
  • الـ commits
  • منطقة التجهيز (staging)
  • الفروع (branches)
  • الدمج (merges)
  • التعارضات (conflicts)
  • .gitignore

تعلّم أولًا

83 دقيقة قراءة · 3 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Initialize a repository, stage changes, and write clear commit messages.
  2. Inspect history and differences with log, status, and diff.
  3. Create, switch, and merge branches, and resolve a merge conflict by hand.
  4. Write a .gitignore that excludes build output and secrets.

الدروس

  1. 01لماذا التحكم في الإصدارات12 د قراءة
  2. 02المستودعات والتجهيز والـ commits11 د قراءة
  3. 03السجل والفروقات (diffs)10 د قراءة
  4. 04الفروع (Branches)10 د قراءة
  5. 05الدمج والتعارضات10 د قراءة
  6. 06.gitignore10 د قراءة
  7. 07عرض عملي: وضع الحسابات المصرفية تحت Git10 د قراءة
  8. 08عرض عملي: إنشاء تعارض دمج وحلّه10 د قراءة

المختبر والتمارين

Lab

BEG-046-LAB1 · Version your work

Outcomes: 1–4 · Time: ~3 h Put the Bank Accounts project under Git with meaningful commits (at least five). Create a feature branch, make conflicting changes on both branches, merge, and resolve the conflict by hand. Add a .gitignore. Acceptance: clean history (clear messages, no target/ or .idea/); conflict resolved correctly.

Exercises (assessment: terminal-only Git task)

IDOutcomeTask
BEG-046-EX011In a new folder, initialize a repo, create Hello.java, stage and commit it with a clear message.
BEG-046-EX021Rewrite these bad messages as good ones: "fix", "stuff", "changes". Use a bug-fix example of your own.
BEG-046-EX032Change a file, then show the difference unstaged and staged. Which two commands did you use?
BEG-046-EX042List the last five commits in one-line form.
BEG-046-EX053Create branch greeting, commit a change, switch back, and merge with no conflict.
BEG-046-EX063Make both branches edit the same line, merge, and resolve the conflict.
BEG-046-EX074Write a .gitignore for a Java project; prove target/ stays untracked.
أظهر الحلول
  • EX01 git init, git add Hello.java, git commit -m "Add Hello program".
  • EX02 e.g. "Fix negative balance after withdraw", "Add Account class with deposit", "Rename amount to balance".
  • EX03 git diff (unstaged) and git diff --staged.
  • EX04 git log --oneline -5.
  • EX05 git switch -c greeting, commit, git switch main, git merge greeting (fast-forward).
  • EX06 After git merge, open the file, keep the intended text, delete the markers, git add file, git commit.
  • EX07 target/, *.class, .idea/, .env; git status does not list them.

الاختبار

Outcomes: O1 init, stage, commit · O2 inspect history · O3 branch and merge · O4 .gitignore.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1Which command turns a folder into a Git repository?O1
  2. 2Staging means:O1
  3. 3Which message is best?O1
  4. 4Which command lists past commits?O2
  5. 5Which shows changes already staged?O2
  6. 6Which creates and switches to a new branch?O3
  7. 7A merge conflict happens when:O3
  8. 8After fixing conflict text in a file you must:O3
  9. 9Which belongs in .gitignore?O4
  10. 10A password was committed by mistake. Best response:O4

الجزء العملي

Terminal-only Git task: init, commit, branch, conflict, merge, .gitignore (EX01–EX07 and the lab). Pass: at least 8 of 10 quiz questions and a clean history with the conflict resolved.

أخطاء شائعة

"fix" commit messages; committing target/ or .idea/; committing passwords.

التقييم

Terminal-only Git task.

الصلة بالمسار الوظيفي

Daily tool; team workflows in JNR-053.

اكتب للبحث في المستويات والمراحل والوحدات والدروس.