Git & Version Control
git (Version control system that tracks changes to your code. The foundation of collaborative development.) is probably the most important thing to understand when doing any kind of real work with coding agents. Git (A version control system that tracks changes to your code. It lets you save snapshots, collaborate with others, and undo mistakes.) is version control (Version control tracks changes to files over time, letting you revert to earlier versions and collaborate without overwriting each other’s work. Git is the most popular version control system.) - saving your work, but you can go back to any previous save at any time.
Commits
Section titled “Commits”When you’re working on a project and you make a change, you commit it. A commit (A saved snapshot of your code at a specific point in time. Like a checkpoint you can always go back to.) is just a snapshot. It’s like saying, “Okay, this is what the project looks like right now, and it’s in a good state, so let’s save this checkpoint.” And you write a little message, like “added the new header” or “fixed that bug,” so future you knows what that change was.
Branches
Section titled “Branches”And then there are branches. A branch is like a parallel version of your project.
You might have your main branch, which is the real version, the live thing, and then you create a new branch to try something out. Like, “Let’s experiment with this new design” — branch off, do the work, and if it works, merge it back into main (bring the new work back onto the main work to incorporate it). If it doesn’t work out, just delete that branch and nothing’s changed.
Push & Pull
Section titled “Push & Pull”Local and remote comes back here.
When working on your computer, your commits are local to your machine. They only exist on your computer. When you push (Sends your saved code changes from your computer to an online repository so others can see them. Like uploading a document to a shared folder so your team can access the latest version.), you’re sending those commits to the remote, which is usually GitHub (A website where developers store, share, and collaborate on code projects.), somewhere in the cloud. And when you pull, you’re bringing down changes that someone else pushed, or that you pushed from a different machine. So push is upload, pull is download, basically.
Repositories
Section titled “Repositories”And a repo (A folder that Git tracks. It contains your project files plus the entire history of changes.), a repository, is just a project folder that has git set up. That’s all it is. It’s got a hidden .git folder inside it that tracks all of these commits and branches. So when someone says “clone this repo,” they’re saying download this project from GitHub to your machine so you can work on it locally.
How Agents Use Git
Section titled “How Agents Use Git”The coding agent will do all of this for you. It’ll commit, it’ll push, it’ll create branches.
It’s good to understand what it’s doing as it may ask you “Do you want me to commit this?” and you’ll know what that means. If (when) something goes wrong, git is how you undo it.