Introduction to Git & GitHub
The version-control foundation every DevOps engineer builds on.
If Linux is where your code runs, Git is how your code is tracked, shared, and shipped. Every serious software and DevOps team on the planet uses version control β and Git is the standard.
π― Learning Objectives
By the end of this lesson you will:
- Understand what version control is and why it matters
- Know the difference between Git and GitHub
- Understand the core Git workflow
- Install and configure Git
What is Version Control?
Version control is a system that records changes to your files over time, so you can:
- Go back to any previous version
- See who changed what, and when
- Work on the same project with a whole team β without overwriting each other
Without it, teams end up with folders like project_final_v2_REALLY_final.zip. Git ends that chaos.
Git vs GitHub β Whatβs the Difference?
| Git | GitHub | |
|---|---|---|
| What it is | A tool that runs on your machine | A website / cloud service |
| Job | Tracks changes locally | Hosts your Git repositories online |
| Works offline? | Yes | No (itβs a remote) |
| Analogy | The camera taking snapshots | The photo album you share with others |
π‘ The one-line version
Git is the version-control tool. GitHub is a place to store and share Git repositories in the cloud (alternatives include GitLab and Bitbucket).
The Core Git Workflow
Almost everything in Git follows this cycle:
Working Directory β Staging Area β Repository β GitHub
(edit files) (git add) (git commit) (git push)You edit files, stage the changes you want to keep, commit them as a snapshot, and push them to GitHub to share.
Install & Configure Git
sudo apt update && sudo apt install git -y # Ubuntu / WSL
git --version # verifySet your identity once β every commit you make is stamped with it:
git config --global user.name "Your Name"
git config --global user.email "you@example.com"π§ͺ Hands-on Lab
Set Up Git on Your Machine
- Install Git and confirm the version
- Set your global
user.nameanduser.email - Confirm the settings with
git config --list
π§ Knowledge Check
What is the main difference between Git and GitHub?
Which command records a snapshot of your staged changes?
πΌ Interview Preparation
Why do DevOps teams consider Git essential?
Summary
You now understand what version control is, how Git and GitHub differ, and the edit β add β commit β push workflow. Next, youβll run these commands for real.