Galle, LK--:--5/6 sites live

What is DevOps? Culture, CAMS & Git Version Control

පිටුව 12: DevOps කියන්නේ ඇයි සහ මොකක්ද? CAMS සහ Git Version Control

Wall of Confusion බිඳ හෙලූ DevOps විප්ලවය, CAMS මූලධර්ම, Git 3-Stage Model, Branching (feature/fruits) සහ Merge Conflicts විසඳන හැටි.

13 Sept 20264 min readSelf Guide · Stage 11#DevOps#Git#SRE Labs

Lab 12 of 20 · DevOps & Git · 5 hands-on activities · bilingual (English + සිංහල)

පිටුව 12: DevOps කියන්නේ ඇයි සහ මොකක්ද? CAMS සහ Git Version Control

Wall of Confusion බිඳ හෙලූ DevOps විප්ලවය, CAMS මූලධර්ම, Git 3-Stage Model, Branching (feature/fruits) සහ Merge Conflicts විසඳන හැටි.

💡 සරල සිංහලෙන්: DevOps ආවේ ඇයි සහ Git Time Machine එකක් වෙන්නේ කොහොමද?

Wall of Confusion:
Developer කෙනෙක් ලස්සනට Code එක ලියනවා. එයාගේ Laptop එකේ සුපිරියට වැඩ. හැබැයි Server එකට දාන්න දුන්නම Sysadmin කියනවා "මේක Server එකේ Crash වෙනවා, දාන්න බෑ" කියලා. Developer කියනවා "මගේ ලැප් එකේ වැඩ කරානේ, ඔයාගේ Server එකේ අවුලක්" කියලා. දෙන්නා රණ්ඩු වෙනවා!

DevOps සහ Git:
මේ දෙගොල්ලොන්ව එකතු කරලා එකම Team එකක් කළා. Git මඟින් හැම code පේළියකම history එක තියාගෙන, automated pipelines මඟින් code එක test කරලා deploy කරන එකයි DevOps කියන්නේ.

Architectural Foundation & Systems Diagram

For decades, IT organizations suffered from a structural civil war known as the Wall of Confusion. Developers were rewarded for changing things quickly, while Operations were rewarded for keeping systems stable.

  • 🤝 The CAMS Framework — • Culture: Blameless collaboration.
    • Automation: CI/CD replaces manual toil.
    • Measurement: Telemetry drives decisions.
    • Sharing: Lessons shared across silos.

  • 🌿 Git 3-Stage Architecture — • Working Directory: Local workspace where files are edited.
    • Staging Area: Prepares snapshots via git add.
    • Local Repository: Cryptographic commit history via git commit.

  • 💥 Merge Conflicts — Occurs when two developers edit the same lines of code. Git marks the conflict with <<<<<<< HEAD, =======, and >>>>>>>. Resolve by hand, then add and commit.

Step-by-step practical lab

Step 01: Check Git Working Tree & Staging Status

සිංහලෙන් — Code එකේ සිදු වූ වෙනස්කම් Git Status මඟින් බලාගනිමු.

Display modified files, staged files, untracked files, and active branch state in the Git repository.

ExampleShell
git status
  • status : Staging index එක සහ local repository එකේ තත්ත්වය පෙන්වයි.

Expected output

Output
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
	modified:   configs/nginx.conf

Untracked files:
	scripts/deploy_canary.sh

SRE Tip: Always run git status and git diff before git commit to review every single line being shipped to production.

Step 02: List Local and Remote Git Branches

සිංහලෙන් — Git Repository එකේ තියෙන සියලුම Branches පරීක්ෂා කරමු.

Query all local branch references and identify the currently checked-out branch.

ExampleShell
git branch
  • branch : පවතින සියලුම branches පෙන්වයි. * ලකුණෙන් සක්‍රීය branch එක දක්වයි.

Expected output

Output
* main
  feature/fruits
  hotfix/memleak

SRE Tip: In trunk-based development, feature branches are short-lived (merged within 24-48 hours) to prevent massive merge conflicts.

Step 03: Create & Switch to New Feature Branch

සිංහලෙන් — අලුත් Feature Branch එකක් (feature/fruits) සාදා මාරු වෙමු.

Execute git checkout with the -b flag to create and switch to a dedicated feature branch.

ExampleShell
git checkout -b feature/fruits
  • -b : Create & Checkout: අලුත් branch එකක් සාදා එකවර එයට මාරු වේ.

Expected output

Output
Switched to a new branch 'feature/fruits'

SRE Tip: Never commit directly to main/master in enterprise environments; always submit a Pull Request with automated CI test checks.

Hands-on practice activities

Work through these yourself — tick them off as you go.

  • Activity 56: Check Git Working Tree Status (Drill) — Inspect staged, unstaged, and untracked files in the active git repository.
  • Activity 57: List Local Git Branches (Drill) — Query all local branch references and identify the currently checked-out branch.
  • Activity 58: Course Branching (feature/fruits) (Checkpoint) — Remember the instructor's command: 'git checkout -b feature/fruits' creates and immediately switches to the new feature branch.
  • Activity 59: Blameless Postmortem Principle (Checkpoint) — In a DevOps culture, when production breaks, you do NOT fire the engineer who typed the command. You fix the system so that one mistake cannot break production.
  • Activity 60: Git Staging Command Quiz (Quiz) — Which command moves changes from the Working Directory into the Staging Index? Answer: git add.

Keep going: ← Lab 11 · Lab 13 → · Track your progress in the Self Guide

ExerciseKnowledge check

Which Git command creates and immediately switches to a new feature branch? / අලුත් branch එකක් සාදා එකවර මාරු වන command එක කුමක්ද?

Finished this one?

Part of Self Guide · Stage 11: SRE Labs II — cloud, containers and delivery. Progress is saved in this browser.

Guide