Learn what Git is and why version control matters: distributed versus centralized systems, how Git stores history and the key terms to know first.
Git is a version control system that tracks changes to files over time. It is most often used for source code, but it can track almost any text-based project. Instead of saving files as final-v2-really-final.txt, Git stores a history of changes so you can see what changed, who changed it, and when it changed.
In practice, Git lets you work safely. You can experiment, undo mistakes, compare versions, and collaborate with other people without constantly copying folders by hand.
Tip: Think of Git as a timeline for your project. Every important save point becomes part of a history you can inspect and reuse later.
Without version control, teams run into familiar problems:
Git solves these problems by recording snapshots called commits. Each commit has an ID, message, author, and timestamp. Because Git stores history, you can answer useful questions like:
Imagine you change a deployment script and production starts failing. With Git, you can compare the current script to the previous commit and quickly spot the mistake:
That is far safer than guessing or restoring random backup files.
git log --oneline
git diff HEAD~1 HEAD -- deploy.shGit does not track “the latest file only.” It stores snapshots of your project over time. When you create a commit, Git records the state of tracked files at that moment.
A simple workflow looks like this:
Later, after editing the file again:
Now you have two checkpoints. You can inspect either version whenever needed.
git init
git add app.js
git commit -m "Add initial app file"Git is not the only version control system. Older tools include Subversion (SVN), Mercurial, and CVS.
Here is a practical comparison:
Git became popular because it is fast, reliable, and excellent at branching and merging. Modern platforms such as GitHub, GitLab, and Bitbucket also made Git collaboration easier.
Teams often choose Git because it supports:
The biggest conceptual difference is between centralized and distributed systems.
In a centralized system, there is one main server with the official history. Developers check files in and out from that server.
Git is a distributed version control system. Every clone contains the full repository history, not just the latest files.
Note: Even though Git is distributed, teams usually still use a shared remote repository such as GitHub as the collaboration hub.
Git is not only for application code. DevOps teams use it for:
This matters because change history is critical in operations. If a deployment pipeline breaks, Git helps you trace the exact configuration change that caused it.
A repository or repo is the project folder Git tracks, including its history.
A commit is a saved snapshot of tracked changes.
A branch is an independent line of work, often used for features or fixes.
A clone is a full local copy of a repository.
A remote is a shared repository location, such as one hosted on GitHub.
Git helps you manage change safely. It gives you history, accountability, collaboration, and the confidence to experiment without losing work. Compared with older centralized tools, Git gives every developer a full local history and makes branching much easier.
If you remember one idea, remember this: Git is not just a backup tool. It is a system for working with change in a controlled, reviewable way.
Scenario: You clone a Git repository before boarding a flight and lose internet access.
Question: Which capability from this lesson still lets you inspect old commits and make new local commits while offline?
Identify the Git feature that makes offline history inspection and local commits possible.
Scenario: A teammate keeps saving files as deploy-final-v3-really-final.sh to track changes manually.
Question: What Git concept from this tutorial directly solves that problem?
Choose the Git concept that replaces manual file versioning with structured history.
Scenario: A deployment pipeline started failing after a recent configuration edit.
Question: According to the tutorial, why is Git especially useful in this DevOps situation?
Pick the reason Git helps trace a broken pipeline or infrastructure change.
Install Git on macOS, Linux and Windows, then configure what matters: your identity, default branch, editor and .gitattributes for consistent line endings.
Learn the everyday Git loop with init, clone, status, add, commit, log and diff, understand the staging area and build checks to run before every commit.
Learn what a Git branch really is, git switch versus checkout, how HEAD and detached HEAD work, and how to delete, rename and name branches well.