Version control (Git)

  • Standard term

Version control is a way of recording saved versions of a project so you can compare them and go back to an earlier one. Git is a widely used version-control tool, common for code.

Each commit records the chosen files, a note on what changed, and a link to the one before it, forming a chain back to the start. Git can compare any two points on it line by line, return files to an earlier one, and keep separate lines of work, “branches,” to combine later.

Where you’ll meet it

Your coding agent spends an hour reworking your website's layout across twelve files. Now the menu won't open on phones, and you can't tell which change did it. Your last commit was this morning, before the session.

What to do

Ask the agent to show what changed since this morning's commit, and to put the files back to that commit if the cause isn't clear. Then redo the layout in smaller steps, committing after each one that works, so the next problem is one step from a good version.

Easy to mix up

When is a version saved?
Version control (Git)Version history
When someone chooses to commitAutomatically, every so often as you type

Check yourself

An agent edited your app's code and also deleted rows from its database. You have a Git commit from before the session. What can that commit restore?

Go deeperGit was built to manage the code at the core of Linux

Linus Torvalds wrote it in 2005 for the Linux kernel, the core program of the Linux operating system, after its developers lost free use of BitKeeper, the commercial tool they had relied on. He made Git distributed, meaning every clone holds the full history, so people can commit without a connection. Hosting services such as GitHub add sharing and review on top.

Git's revert command adds a new commit that undoes an old one while every earlier commit stays where it was, so teams use it once others have copies of the history. Its reset command moves the branch back and drops the later commits from it, which can lose work others depend on.

A line-by-line comparison means little for binary files such as videos, images, or datasets, and each new version of one can add close to its full size to the history. Teams keep such files outside the repo or use an extension such as Git LFS, which stores them elsewhere and leaves a short note in each one's place saying where it lives.

Practice Build Basics

Or take the learning quiz on a mix of every set