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

الفصل 1الاسم في الدورة: Git basics

Track changes with your first repository

Git saves snapshots of a folder. Every snapshot (a commit) has a message, an author and a pointer to the one before — a full history you can search, compare and go back to. This chapter covers setup, the three areas, and the daily commands.

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

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

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

1.1

Set up Git once

Tell Git who you are. These values go into every commit.

git config --global user.name "Hosam Hani"
git config --global user.email "76218642+s0sta@users.noreply.github.com"
git config --global init.defaultBranch main
git config --global pull.rebase true
git config --global core.editor vim
git config --list --show-origin
LevelFileOption
System/etc/gitconfig--system
User~/.gitconfig--global
Repository.git/config(default)

في العمل

Use GitHub's noreply address in public repositories, so your real email is not in the history.

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

1.2

Know the three areas

A file moves through three places: the working tree (your files), the staging area (the next commit), the repository (saved commits).

working tree  --git add-->  staging area  --git commit-->  repository (.git)
     ^                                                        |
     +----------------------- git restore / switch -----------+
mkdir infra && cd infra
git init
echo "# Infra" > README.md
git status
git add README.md
git status -s
A  README.md
git commit -m "Add README"

1.3

Make good commits

One commit = one logical change, with a clear message: a short summary line, then (optional) why.

git add main.tf variables.tf
git add -p network.tf
git commit -m "Add web subnet and NSG"
git commit -am "Raise VM size for staging"
git commit --amend -m "Add web subnet, NSG and route table"
OptionMeaning
git add -pChoose parts of a file to stage
git commit -aStage all changed tracked files and commit
--amendReplace the last commit (only before you push it)

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

1.4

Look at the history

git log shows commits; git show one commit; git diff the changes.

git log --oneline --graph --decorate --all
git log -p -- main.tf
git log --author="Hosam" --since="2 weeks ago"
git show HEAD~1
git diff
git diff --staged
git diff main..feature -- modules/
NameMeans
HEADThe commit you are on
HEAD~1, HEAD~2One / two commits before
abc1234A commit by its short hash
main..featureCommits in feature that are not in main

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

1.5

Ignore files

.gitignore lists files Git must never track: build output, logs, local settings, and secrets.

.gitignore
*.log
.env
.terraform/
*.tfstate*
__pycache__/
node_modules/
git check-ignore -v .env
git rm --cached .env

انتبه

.gitignore does not remove a file that is already committed. git rm --cached FILE stops tracking it — but it stays in the old history. A committed secret must be rotated (changed), not only deleted.

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

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