Please enable JavaScript to use CodeHS

Agentic Engineering & AI Software Topics

Version control and collaboration

Version control keeps a history of every change to a project. It lets many people, and even many AI agents, work on the same codebase without stepping on each other's work. The most popular version control system is Git.

Git ~10 min High School / College Prep
The Big Idea

Why version control matters

Imagine a group project where everyone edits the same file at the same time. Someone deletes your section. Another person rewrites your paragraph. How do you get the good parts back?

Version control solves this. It stores snapshots of the project, called commits, and lets you see what changed, who changed it, and when. If something breaks, you can rewind.

Key idea: version control is a time machine for code. It makes teamwork and experimentation safer.


CS Minute

Commits and history

A commit is a saved version of the project. Each commit has a message describing what changed. Together, commits form a history that looks like a linked list: each commit points to the one before it.

Good commit messages explain why the change was made, not just what changed. This matters when an AI agent is generating many small changes; clear history helps humans review the agent's work.


Workflows

Branches and isolation

A branch is an independent line of development. You create a branch to work on a feature or a bug fix without disturbing the main code. When the work is ready, you merge the branch back into main.

Branches are essential for agentic engineering. An agent might create a branch for every experiment, test it, and either merge it or discard it. This keeps the main codebase stable.

Conflict warning: when two branches change the same file, Git may not know which version to keep. A human has to resolve the merge conflict. Good design and small branches reduce conflicts.


Code

See a code diff

At the heart of version control is a diff — a view of exactly what changed between two versions of a file. This example shows a small Python function before and after a commit that adds an optional argument.


Interactive

Build a branch graph

Use the buttons to add commits to main or feature, then merge the feature branch back into main. Watch how the graph grows.

main
main has no commits yet.

Your Turn

Check yourself

Why would an AI agent use a branch instead of editing the main code directly?

Your answer:

Sample answer: A branch keeps experiments isolated. If the agent's changes break something, the main code stays safe, and humans can review the branch before merging.


Check Yourself

Quick quiz

1. What is a commit in Git?

2. What does a branch let you do?

3. What is a merge conflict?

Keep learning

Version control is the safety net that lets teams and agents experiment. Next, learn how continuous integration and testing keep every change honest.

Part of the “Agentic Engineering & AI Software Topics” series.