Git Fundamentals for Developers
By the end of this lesson, you'll be able to:
- Explain what version control is and the problem it solves
- Use the core git workflow: clone, add, commit, push, pull
- Read a commit history to understand what changed and why
Prerequisites: Module 13: "Apex Language Essentials"
The problem version control solves
Without version control, "final_v2_reallyfinal.apex" style filenames are the alternative — no real history, no way to see who changed what or why, no safe way for two developers to work on the same file at once. Git solves all of this: every change is recorded, attributed, and reversible.
The core workflow
git clone https://github.com/your-org/your-project.git
cd your-project
# make changes to a file
git add DeliveryVan.cls
git commit -m "Add cargoCapacityKg field to DeliveryVan"
git push origin main
clone— download a copy of the repository, once.add— stage a specific change to be included in the next commit.commit— save a snapshot of your staged changes, with a message explaining why.push— send your local commits to the shared remote repository.
git pull is the reverse of push — it downloads commits other developers have pushed since you last synced.
Reading history
git log --oneline
# a1b2c3d Add cargoCapacityKg field to DeliveryVan
# 9f8e7d6 Fix null check in enroll() method
# 5c4b3a2 Initial commit
Every commit is a permanent, readable record — git log shows what changed and when, and git show a1b2c3d shows exactly what that specific commit changed line by line. This history is what makes it possible to understand why code looks the way it does, months later.
Exercise
As a comment, list the four core git commands covered in this lesson, in the order you'd typically use them when contributing a change.
Show hint
clone (once) → add → commit → push
Git Fundamentals for Developers Quiz
My Notes
Log in to keep private notes on this lesson.
Questions about this lesson
No questions yet — be the first to ask.
Log in to ask a question about this lesson.
Summary
Git tracks every change to a codebase over time, letting multiple developers work on the same project without overwriting each other's work — the foundation every other practice in this module builds on.