0Pricing
Linux Command Line Mastery · درس

التفرّع والدمج باستخدام Git من سطر الأوامر

وسّع أساسيات Git لديك بالعمل مع الفروع: أنشئ الفروع وبدّل بينها وادمجها وحلّ التعارضات واتبع سير عمل نظيفًا لفروع الميزات.

التفرّع والدمج باستخدام Git من سطر الأوامر درس مجاني في Linux Command Line Mastery على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Linux Command Line Mastery، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Linux Command Line Mastery 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

Why Branches?

You know how to commit and track files. Branches let you develop features in isolation without disturbing the main line of work, then merge them back when ready.

Listing Branches

git branch lists branches and marks the current one with an asterisk.

git branch

Creating and Switching

git switch -c name creates a branch and moves to it in one step. (Older Git uses git checkout -b.)

git switch -c feature-login

Committing on a Branch

Commits you make now belong only to the feature branch, leaving main untouched.

git add .
git commit -m 'Add login form'

Switching Back

Return to main with git switch main. Your feature work is safely stored on its own branch.

git switch main

Merging a Branch

From main, git merge brings the feature commits in. A fast-forward happens when main has no new commits.

git merge feature-login

Handling Merge Conflicts

If the same lines changed on both branches, Git pauses and marks conflicts with <<<<<<< markers. Edit the file to resolve, then stage and commit.

git add resolved-file.txt
git commit

Deleting Merged Branches

After merging, clean up with git branch -d. Git refuses if the branch is not merged, protecting your work.

git branch -d feature-login

Comparing Branches

git diff between branches shows exactly what differs before you merge.

git diff main..feature-login

Pushing a Branch

Share a branch by pushing it and setting upstream tracking with -u.

git push -u origin feature-login

A Clean Workflow

The feature-branch loop: branch from main, commit, push, open a pull request, merge, delete the branch. This keeps history organized and reviewable.

Quick Check

Which single command both creates a new branch and switches to it?

Recap

You can now manage parallel work:

  • git switch -c creates and moves to a branch
  • git merge integrates; conflicts are resolved by editing then committing
  • git branch -d cleans up merged branches
  • git push -u origin shares them

Branch per feature, merge when done.

الأسئلة الشائعة

هل درس «التفرّع والدمج باستخدام Git من سطر الأوامر» مجاني؟

نعم — نص درس «التفرّع والدمج باستخدام Git من سطر الأوامر» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Linux Command Line Mastery، انتقل إلى CoddyKit PRO. تتضمن دورة Linux Command Line Mastery 4 دروس في المجموع.

ماذا ستتعلم في «التفرّع والدمج باستخدام Git من سطر الأوامر»؟

وسّع أساسيات Git لديك بالعمل مع الفروع: أنشئ الفروع وبدّل بينها وادمجها وحلّ التعارضات واتبع سير عمل نظيفًا لفروع الميزات. تتمرن على Linux Command Line Mastery مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Linux Command Line Mastery؟

لا تُشترط خبرة سابقة. Linux Command Line Mastery على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «التفرّع والدمج باستخدام Git من سطر الأوامر»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Linux Command Line Mastery هذا؟

نعم. كل درس في Linux Command Line Mastery يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. أساسيات Git من سطر الأوامر
  2. متغيرات البيئة والأسماء المستعارة
  3. تهيئة Shell: `.bashrc` و`.zshrc` و`.profile`
  4. التفرّع والدمج باستخدام Git من سطر الأوامر
← العودة إلى Linux Command Line Mastery