لابات Git عملية

لابات Git بتحطك في فريق حقيقي شغال على مشروع واحد من أول commit لحد ما ترجّع production. بتعمل branches و تحل conflicts، تشتغل مع زمايلك على remote محمي، تصلّح غلطاتك من غير ما تضيّع شغل، تطلع releases، وتدوّر على الـ commit اللي كسر الدنيا بـ bisect.

هتتدرب على إيه في لابات Git؟

  • Working tree و Index و Commits
  • .gitignore و حماية الـ secrets
  • Branches و Merge
  • Merge conflicts
  • Stash
  • Remotes و Push و Fetch
  • Rebase و Cherry-pick
  • Restore و Reset و Revert
  • Reflog و استرجاع الشغل
  • Tags و Releases
  • Hooks و Worktrees و Submodules
  • Blame و Bisect
  1. 01
    Configure Git for OpsTrack

    First day on the OpsTrack team: before anyone commits, Git has to know who they are and how this team starts a repository.

    مبتدئ · 15 دقيقة

  2. 02
    Initialize the OpsTrack Repository

    Put OpsTrack under version control and stage its first file — without committing anything yet.

    مبتدئ · 15 دقيقة

  3. 03
    Create the First Snapshot

    Record OpsTrack's first reviewable history: the README first, then the service — and keep a local secret out of it.

    مبتدئ · 20 دقيقة

  4. 04
    Inspect Changed, Staged and Committed Content

    Two unrelated edits, one file each: see exactly what is in the working tree, the index and the last commit, and commit them separately.

    مبتدئ · 20 دقيقة

  5. 05
    Protect Secrets and Generated Files

    A local test run left artefacts behind and someone staged the production env file. Get the secret out and make the repository keep it out.

    مبتدئ · 25 دقيقة

  6. 06
    Build Atomic Commits with Selective Staging

    An endpoint and a log fix, tangled in one file overnight. Stage hunk by hunk and give reviewers two commits.

    مبتدئ · 25 دقيقة

  7. 07
    Read Project History

    Answer four questions about OpsTrack's history with evidence from Git, for the team's onboarding page.

    مبتدئ · 20 دقيقة

  8. 08
    Create a Health-Check Feature Branch

    Kubernetes needs a readiness probe before the staging rollout. Build it on a branch so main stays releasable while you work.

    مبتدئ · 25 دقيقة

  9. 09
    Compare and Merge Completed Work

    OPS-110 is approved. Review exactly what the branch changes, merge it into main, and clean up.

    مبتدئ · 20 دقيقة

  10. 10
    Handle an Urgent Interruption with Stash

    Half-way through metrics work, production needs a config fix now. Park your work, fix main, and pick up exactly where you left off.

    مبتدئ · 25 دقيقة

  11. 11
    Resolve a Content Conflict

    You and Alice changed the same line. Merge her branch, resolve the conflict to the value the team agreed, and keep the rest of her work.

    مبتدئ · 25 دقيقة

  12. 12
    Resolve a Modify/Delete Conflict

    Carol retired a script on main; Bob's branch still edits it. Merge Bob's work, keep the script deleted, and carry his change to where it belongs now.

    مبتدئ · 25 دقيقة

  13. 13
    Compare Fast-Forward and Three-Way Merges

    Two approved branches, one team policy: fast-forward when you can, an explicit merge commit for CI changes. Predict from the graph, then integrate both.

    مبتدئ · 25 دقيقة

  14. 14
    Publish OpsTrack to the Team Remote

    The platform team created an empty shared repository. Connect OpsTrack to it, publish main with tracking, and keep your private experiment private.

    متوسط · 20 دقيقة

  15. 15
    Clone and Join an Existing Project

    Your workstation was reimaged and Carol has cut a release branch. Clone the team repository and set up a local release branch that tracks it.

    متوسط · 20 دقيقة

  16. 16
    Fetch Before Integrating

    Alice is pushing Terraform for a new region. See her work arrive, inspect it before it touches your branch, then integrate with a fast-forward only.

    متوسط · 20 دقيقة

  17. 17
    Handle a Diverged Branch

    You committed a replica change; Bob pushed an Ansible change first. Read the rejected push, integrate both histories, and publish without force.

    متوسط · 25 دقيقة

  18. 18
    Publish a Feature for Review

    Production alert rules go through review. Publish a branch, generate a pull request with Git itself, and answer review feedback with a follow-up commit.

    متوسط · 25 دقيقة

  19. 19
    Rebase Unpublished Work onto Updated main

    Your private log-rotation branch is based on last week's main, and Alice changed the same Ansible play. Replay your commits on top of the team's main and publish a linear branch.

    متوسط · 30 دقيقة

  20. 20
    Cherry-Pick an Approved Contribution

    release/1.0 needs Bob's Cache-Control fix — and nothing else from his branch. Copy exactly that commit, record where it came from, and publish the release branch.

    متوسط · 25 دقيقة

  21. 21
    Restore the Correct Git Layer

    A messy morning: debug junk in a doc, a local tweak staged by mistake, and a deleted script. Fix each one in the layer where it lives, without a commit.

    متوسط · 20 دقيقة

  22. 22
    Compare Soft, Mixed and Hard Reset

    Three disposable clones, three practice commits each. Squash with --soft, uncommit with --mixed, discard with --hard — and see that the reflog still remembers.

    متوسط · 30 دقيقة

  23. 23
    Revert a Shared Production Change

    Yesterday's pushed change to 32 workers ran staging out of memory, and Alice has pushed on top of it. Undo it publicly with a revert — never by rewriting main.

    متوسط · 25 دقيقة

  24. 24
    Recover a Deleted Branch with the Reflog

    A hasty clean-up deleted an unpushed branch with two days of work. Find its commits in the reflog, recreate the branch, and publish it before anything else goes wrong.

    متوسط · 20 دقيقة

  25. 25
    Clean an Unpublished Branch with Interactive Rebase

    Five noisy commits — wip, fix typo, oops — on a private branch. Rewrite them into one feature commit and one docs commit that a reviewer can read, without losing a byte.

    متوسط · 30 دقيقة

  26. 26
    Prepare Annotated Release v1.0.0

    Carol approved 1.0.0. Record the changelog, then mark exactly that commit with an annotated release tag — the object your deployment pipeline will trust.

    متوسط · 20 دقيقة

  27. 27
    Publish and Verify the Release Tag

    The pipeline deploys tags. Publish the release commit and the v1.0.0 tag — and only that tag — then see why a published release tag must never move.

    متوسط · 15 دقيقة

  28. 28
    Apply .gitattributes and Line-Ending Consistency

    Bob committed from a Windows laptop and the smoke test now dies with bash\r. Make the repository — not each laptop — decide line endings, then normalize history from here on.

    متوسط · 25 دقيقة

  29. 29
    Add a Local Pre-Commit Quality Gate

    After the near miss with a secret, the team wants a shared hook that blocks secret-like values and whitespace errors before they are ever committed.

    متوسط · 25 دقيقة

  30. 30
    Use Git Worktrees for Concurrent Work

    Mid-way through Helm edits, Bob's commit breaks the staging probe. Fix it in a second working tree on the team's latest main — without stashing or disturbing your Helm work.

    متوسط · 25 دقيقة

  31. 31
    Manage a Pinned Submodule

    The SRE runbooks live in their own repository. Include them in OpsTrack pinned to the reviewed v2.3.0, not whatever is newest, and publish the pin.

    متوسط · 30 دقيقة

  32. 32
    Search History with grep, log -S and log -G

    Prepare a post-mortem: when did the connection cap appear, when did a flag die, how often did the log format change, and what did the 1.0.0 release actually contain?

    متقدم · 25 دقيقة

  33. 33
    Investigate a Line with git blame

    Why is HEALTH_TIMEOUT 2? A move and a whole-file re-indent hide who decided it. See through both, find the reason, and make blame skip the re-indent for the whole team.

    متقدم · 25 دقيقة

  34. 34
    Find a Regression with git bisect

    The config check passed at v1.0.0 and fails on main, with dozens of commits between and one that cannot even run. Let git bisect find the first bad commit, keep the evidence, and clean up.

    متقدم · 30 دقيقة

  35. 35
    Reuse Conflict Resolution with git rerere

    The rate-limit feature must land on release/1.1 and on main, and both conflict the same way. Resolve it once, let Git reuse your resolution, and publish both branches.

    متقدم · 25 دقيقة

  36. 36
    Recover OpsTrack and Publish v1.1.1

    INC-101: since the 1.1.0 rollout, /health answers 404 and the load balancer is draining pods. Protect your own work, find the commit that broke production, ship a minimal, auditable v1.1.1, and get back to what you were doing.

    متقدم · 1.5 ساعة

شوف الكورس كامل

ليه تتعلم Git بالتطبيق العملي؟

  • أغلب الناس بتستخدم Git كل يوم وبتدوّر على جوجل أول ما حاجة تبوظ. اللاب بيخليك تبوّظها وتصلّحها بإيدك.
  • كل لاب بيتحقق من اللي عملته فعلًا في الـ repository وبيقولك إيه اللي لسه ناقص.
  • الكورس بيخلص بـ incident كامل: تحمي شغلك، تلاقي الـ commit الغلط، وتطلع hotfix من غير ما تبوّظ شغل زمايلك.

أسئلة شائعة

اللابات مجانية؟

أيوه. سجّل واشترك في الكورس وابدأ، من غير اشتراك مدفوع.

محتاج حساب GitHub؟

لأ. كل لاب فيه repository تدريبي و remote خاص بالفريق جوه اللاب، ومفيش حاجة بتتبعت على GitHub بتاعك.

مناسبة لمبتدئ؟

أيوه. أول module بيبدأ من إعداد Git وأول commit، ومحتاج بس تعرف تتنقل في الـ terminal.