Welcome to Module 3 of Fundamentals of Platform Engineering!
In this module, we are going to learn about Version Control and Git.
Version control at its most basic level is just a way to keep track of who changed what and when.
Imagine a massive codebase with hundreds of engineers working on it. One person adds a new feature, someone else changes a file and another person accidentally deletes something important.
Without version control, nobody would easily be able to see: Who made the change, what they changed, when they changed it, what the code looked like before
Version control fixes this by keeping a history of every change.
This means that worst case scenario if someone completely cooks the codebase, we can go back to an older working version.
It is basically like having save points for your code.
Commit Messages
In version control, it is really important to label your changes properly.
When you save a change in Git, this is called a commit.
Every commit has a message explaining what was changed.
For example, a bad commit message would be: fixed stuff
This does not really tell anyone anything.
A better commit message would be: Fix login page error when password is empty
Now another engineer can look through the history and understand what was changed just from the title.
This becomes very important in a large company where there could be hundreds of changes being made every day.
What Is Git?
Git is a version control tool. It runs on your computer and keeps track of changes inside your project.
With Git, you can: See what files have changed, Save changes, Look through previous versions, Create branches, Undo mistakes, Work with other engineers
Git is not only used for normal application code.
Platform Engineers use Git for things like:
Infrastructure code
Dockerfiles
Kubernetes files
Pipelines
Automation scripts
Monitoring configuration
This is why Git is such an important skill to learn.
Git, GitHub and GitLab
Git, GitHub and GitLab are connected, but they are not the same thing.
Git
Git is the actual version control tool.
It is what tracks your changes and lets you create commits.
Some basic Git commands are:
git status
git add
git commit
git log
Git can work completely on your own computer without GitHub or GitLab.
GitHub
GitHub is an online place where you can store Git repositories. It is basically a central place where teams can store their code and work together.
GitHub allows engineers to:
Store code online
Review changes
Create pull requests
Track issues
Run automated workflows
GitLab
GitLab is very similar to GitHub. But much better in my biased opinion haha.
It can also store Git repositories, but it is especially good for CI/CD pipelines.
Pipelines can automatically:
Test your code
Build your application
Scan for security issues
Create Docker images
Deploy applications
Lots of companies use GitLab because it lets them manage their code and pipelines in the same place.
Basic Git Workflow
A basic Git workflow looks like this:
Make a change
↓
Add the change
↓
Commit the change
↓
Push it to GitHub or GitLab
You can also remember it like this:
Edit → Add → Commit → Push
We will practise this properly in the next lessons.
Why Is Git Important in Platform Engineering?
Platform Engineers manage important systems like cloud infrastructure, pipelines, servers and Kubernetes clusters.
Making random changes without tracking them would be very risky.
Git allows us to see exactly what was changed and who changed it.
It also allows other engineers to review the change before it goes live.
For example, instead of logging directly into a server and changing something, a Platform Engineer might update a file in Git.
That change can then be reviewed, tested and deployed automatically.
This makes changes much safer and easier to manage.