التفرّع والدمج باستخدام 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 branchCreating 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-loginCommitting 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 mainMerging a Branch
From main, git merge brings the feature commits in. A fast-forward happens when main has no new commits.
git merge feature-loginHandling 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 commitDeleting 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-loginComparing Branches
git diff between branches shows exactly what differs before you merge.
git diff main..feature-loginPushing a Branch
Share a branch by pushing it and setting upstream tracking with -u.
git push -u origin feature-loginA 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 -ccreates and moves to a branchgit mergeintegrates; conflicts are resolved by editing then committinggit branch -dcleans up merged branchesgit push -u originshares 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 يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- أساسيات Git من سطر الأوامر
- متغيرات البيئة والأسماء المستعارة
- تهيئة Shell: `.bashrc` و`.zshrc` و`.profile`
- التفرّع والدمج باستخدام Git من سطر الأوامر