الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 3الاسم في الدورة: Git branching

Work in branches and merge them

A branch is a movable name for a line of commits. Work on a change in its own branch, keep main always working, then merge the branch back. Branches are cheap in Git — use one for every change.

  • 4 الدروس
  • 2 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

3.1

Create and switch branches

git switch -c NAME makes a new branch from where you are and moves to it.

git branch
* main
git switch -c feature/web-subnet
git branch -v
git switch main
git switch -
git branch -m feature/web-subnet feature/web-network
CommandDoes
git branchList local branches (-a also remote ones)
git switch -c NAMECreate and switch
git switch NAMESwitch
git branch -m OLD NEWRename
git branch -d NAME / -DDelete (merged / even when not merged)

تذكّر

Name branches by purpose: feature/…, fix/…, docs/….

الأوامر في هذا الدرس

3.2

Merge a branch

git merge BRANCH brings the commits of BRANCH into the current branch.

git switch main
git merge feature/web-network
git merge --no-ff feature/web-network -m "Merge web network"
git branch -d feature/web-network
Merge typeWhenResult
Fast-forwardmain has no new commitsmain just moves forward
Three-way mergeBoth branches have new commitsA merge commit with two parents
--no-ffYou want a merge commit anywayHistory shows the feature as a group
--squashYou want one commit for the whole featureOne new commit, branch history not kept

الأوامر في هذا الدرس

3.3

Solve merge conflicts

When both branches changed the same lines, Git stops and marks the conflict in the file. You choose the result.

variables.tf (during a conflict)
<<<<<<< HEAD
default = "Standard_B2s"
=======
default = "Standard_D2s_v5"
>>>>>>> feature/bigger-vm
git status
vim variables.tf
git add variables.tf
git commit
git merge --abort
git checkout --theirs variables.tf

في العمل

Small, short-lived branches give few conflicts. Merge main into a long branch often, or rebase it.

الأوامر في هذا الدرس

3.4

Keep main safe

main should always work. Changes go in through pull requests with checks — see Work with GitHub pull requests.

الأوامر في هذا الدرس

كل الأوامر في هذا الفصل