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

الفصل 5الاسم في الدورة: Rebasing

Keep a clean history with rebase

Rebase moves your commits on top of another branch, as if you had started your work there. The history becomes one straight line — easier to read and review. Interactive rebase also lets you clean up commits before you share them.

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

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

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

5.1

Rebase a branch on main

While you worked, main moved on. Rebase replays your commits on the new main.

git switch feature/web-network
git fetch origin
git rebase origin/main
git push --force-with-lease
before:   main  A---B---C
                 \
          feature D---E
 
after:    main  A---B---C
                         \
          feature         D'--E'

تذكّر

Rebase rewrites commits (new hashes D', E'). Never rebase commits other people already built on — only your own feature branch.

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

5.2

Solve conflicts during a rebase

A rebase stops at each commit that conflicts. Fix it, then continue.

git status
vim main.tf
git add main.tf
git rebase --continue
git rebase --skip
git rebase --abort

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

5.3

Clean up commits interactively

git rebase -i opens a list of your commits. Change the word in front to squash, reword, reorder or drop commits — before you open the pull request.

git rebase -i origin/main
Editor during git rebase -i
pick 1a2b3c4 Add web subnet
fixup 5d6e7f8 typo
pick 9a8b7c6 Add NSG rules
reword 3c4d5e6 wip
drop 7f8e9d0 debug output
WordEffect
pickKeep the commit
rewordKeep, change the message
squashJoin with the commit above, edit the message
fixupJoin with the commit above, keep its message
dropRemove the commit

في العمل

Commit with git commit --fixup=HASH while you work, then git rebase -i --autosquash origin/main puts every fix in the right place.

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

5.4

Choose merge or rebase

Both bring changes together. Teams pick a style and stick to it.

MergeRebase
HistoryTrue, with merge commitsStraight line
Safe on shared branchesYesNo (rewrites)
ConflictsOncePossibly per commit
Common useMerging a PR into mainUpdating your own feature branch

5.5

Pick single commits

git cherry-pick copies one commit from another branch — for example a hot fix from main into a release branch.

git switch release/1.2
git cherry-pick 3f2a9c1
git cherry-pick -x 3f2a9c1

-x adds "cherry picked from commit …" to the message, so the link is clear.

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

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