Agent Skills in Claude Code and Visual Studio Code: Setup, Benefits, Risks, and a Step-by-Step Example
Saving a file preserves its current contents. It does not automatically preserve a clear history of how the file changed, why it changed, or which version still worked before a problem appeared.
That distinction becomes especially important in AI-assisted development.
A coding assistant can modify several files in seconds. Some changes may be useful, while others may introduce errors, remove existing behavior, or affect parts of the project you did not intend to change. Without version control, it can be difficult to understand what happened or return to a stable state.
Git solves this problem by recording meaningful checkpoints in a project’s history.
This article explains how Git works conceptually before we begin using Git commands in the next guide.
By the end of this guide, you should be able to explain:
You do not need to memorize commands yet. The goal is to build a mental model that makes later Git commands easier to understand.
Version control is a system for recording changes to files over time.
It allows you to compare versions, identify who made a change, understand why the change was made, and return to an earlier state when necessary.
Imagine writing a document without version control.
You might create files such as:
project-final
project-final-2
project-final-revised
project-final-revised-new
project-final-revised-new-fixedThis approach creates several problems.
You may not remember:
Git replaces that informal collection of copies with a structured history.
Instead of duplicating the whole project manually, Git records selected changes as commits.
A simplified history might look like this:
A ── B ── C ── DEach letter represents a commit.
For example:
A: Create initial project
B: Add navigation
C: Add contact form
D: Fix form validationThe project history now has a clear sequence.
You can inspect what changed between commits, return to an earlier point, or create a separate branch to experiment without immediately changing the main line of development.
Saving and committing are related, but they solve different problems.
When you save a file, your editor writes the current contents to storage.
When you create a Git commit, Git records a checkpoint based on selected project changes.
Suppose you edit three files:
index.html
styles.css
notes.mdYou save all three files.
At that point, the changes exist on your computer, but Git has not necessarily recorded them as a commit.
You may decide that only index.html and styles.css belong to the current feature. The notes file may be unrelated.
Git allows you to select the relevant changes before recording the checkpoint.
This is one reason a commit is more useful than a simple backup copy. A good commit represents a meaningful unit of work.
Examples include:
A commit should help a future reader understand what changed and why.
A beginner-friendly Git model has three main areas:
The basic flow looks like this:
Working directory
↓
Staging area
↓
Commit historyEach area has a different purpose.
The working directory is the project folder you can see and edit.
It contains the current versions of files such as:
README.md
index.html
app.js
styles.cssWhen you open a project in VS Code and change a file, you are changing the working directory.
For example, suppose app.js originally contains:
function greet(name) {
return `Hello, ${name}`;
}You edit it to:
function greet(name) {
if (!name) {
return "Hello";
}
return `Hello, ${name}`;
}The saved file is now different from the last committed version.
Git can detect that difference.
However, the change is not yet a new commit. It is only a modification in the working directory.
The working directory may contain several kinds of changes at once.
For example:
This is normal during development.
The staging area exists partly because not every current change should automatically become part of the same commit.
The staging area is where you select the changes that should be included in the next commit.
It is sometimes described as a preparation area or an index.
Suppose you changed:
app.js
styles.css
notes.mdThe JavaScript and CSS changes belong to a user-interface improvement. The notes file contains personal reminders.
You may stage only:
app.js
styles.cssThen create a commit describing the interface improvement.
The notes file remains modified in the working directory but is not included in that commit.
This gives you control over the project history.
Without a staging area, Git would have to record every current change together.
That would encourage large, confusing commits.
A useful commit should normally contain changes that belong together.
For example:
Good commit:
Add validation to the contact formThis commit may include:
contact-form.js
contact-form.test.jsA less useful commit might combine:
The staging area helps separate these concerns.
Staging a file does not create a permanent history entry.
It only prepares the selected version for the next commit.
You can still change the file again before committing.
That creates an important distinction:
Working directory version
Staged version
Last committed versionA single file can temporarily have all three states.
For example:
Now Git may see:
This can seem confusing at first, but it gives experienced developers precise control over what enters a commit.
For beginners, a simpler habit is often better:
A commit is a recorded checkpoint in a Git repository.
A commit normally includes:
This creates a chain of project history.
A simplified history might look like:
A ── B ── CEach commit knows which commit came before it.
That relationship allows Git to reconstruct earlier states and compare one point in history with another.
A commit is often explained as a snapshot, which is useful for beginners.
However, Git stores project history efficiently. It does not behave like a folder full of complete manual copies.
From a practical perspective, you can think of each commit as a recoverable project state with a message explaining its purpose.
For example:
a83f21c Add README
b4e9d72 Add form layout
c12a8f4 Validate empty email inputThe short strings are abbreviated commit identifiers.
Git can use those identifiers to inspect or reference specific points in history.
A commit message should explain the purpose of the change.
Weak messages:
Update
Fix
Changes
WorkBetter messages:
Add empty-state message to task list
Fix duplicate form submission
Document WSL setup requirements
Remove unused API clientA future reader should be able to scan the history and understand how the project evolved.
This becomes especially important when AI tools generate changes quickly. A clear commit history helps distinguish intentional work from experiments and failed attempts.
A Git repository contains the project and the version-control information Git uses to track it.
When Git is initialized in a project folder, it creates internal repository data.
You normally do not edit that internal data manually.
The repository allows Git to answer questions such as:
The repository is not only the visible source files.
It also includes the structured history behind them.
A local repository exists on your computer.
A remote repository exists somewhere else, such as GitHub.
The local repository contains the history available on your machine. You can create commits locally without an internet connection.
The remote repository provides a shared or off-device copy of the Git history.
A common relationship looks like this:
Your computer
└── Local Git repository
↓ push
GitHub
└── Remote Git repositoryA push sends local commits to a remote repository.
It does not simply upload the current folder as a random collection of files. It transfers Git history that the remote does not yet have.
A pull retrieves remote changes and integrates them into the local repository.
This matters when:
A common beginner assumption is that GitHub updates whenever a local file is saved.
It does not.
The typical sequence is:
Edit files
→ Stage changes
→ Commit locally
→ Push commitsUntil the push occurs, the new commits may exist only on your computer.
Similarly, a change made on GitHub does not automatically appear in your local folder. You must retrieve it.
A branch is a separate line of development.
The default branch usually represents the main project history.
You can create another branch to work on a feature or experiment without immediately changing the default branch.
A simplified branch history looks like this:
main: A ── B ── C
\
feature: D ── EThe feature branch started from commit B.
Commits D and E belong to the feature branch, while commit C belongs to the main branch.
Later, the feature may be merged back:
main: A ── B ── C ───── F
\ /
feature: D ── E ───Commit F represents the integration of the feature work.
Branches allow you to:
In AI-assisted development, branches can provide an additional safety boundary.
For example, you might create a branch before asking a coding agent to perform a large refactoring. If the result is poor, the main branch remains unchanged.
A branch may feel like a duplicate project, but Git manages branches more efficiently than manually copying the entire folder.
Branches are references to lines of commit history.
This allows developers to switch between different project states without maintaining folders such as:
app-main
app-feature
app-feature-new
app-feature-finalThe Git commands article will later show how branches are managed in practice. For now, the important point is that branches separate work without abandoning version history.
Git compares the current project state with recorded or staged versions.
It may classify files as:
An untracked file exists in the working directory but has not yet been added to Git’s tracked history.
Example:
new-notes.mdGit sees the file but does not assume it belongs in the repository.
This prevents every temporary file from being recorded automatically.
A modified file was previously tracked, but its current contents differ from the last relevant recorded version.
Example:
README.mdYou changed the file after the last commit.
A staged change has been selected for the next commit.
A committed change has been recorded in repository history.
A file can move through these states:
Untracked
↓
Staged
↓
Committed
↓
Modified
↓
Staged
↓
CommittedUnderstanding these states makes Git commands much easier to interpret.
Git protects project history, but it should not be treated as the only backup strategy.
A local Git repository may be lost if the storage device fails.
A GitHub repository provides an off-device copy, but remote repositories can also be deleted, corrupted through forceful history changes, or made inaccessible through account problems.
For important projects, consider:
Git is primarily a version-control system. It is excellent at tracking project changes, but complete disaster recovery may require additional measures.
AI coding tools can produce changes faster than most developers can inspect them manually.
That speed is useful, but it creates risk.
An AI assistant may:
Git gives you evidence.
Before an AI change, you can create a clean checkpoint.
After the change, you can inspect exactly what differs.
A safe loop looks like:
Start from a clean repository
→ Create or confirm a checkpoint
→ Ask the AI for one small change
→ Inspect modified files
→ Test the result
→ Commit only when verifiedThis workflow is more reliable than repeatedly asking the AI to repair its own edits without preserving known-good states.
Git can show what changed. It does not decide whether the change is correct.
You still need to ask:
Git provides the history and comparison tools. Human judgment remains responsible for accepting the result.
You can summarize the basic Git workflow with four questions.
This refers to the working directory.
You inspect which files differ from the last known state.
This refers to the staging area.
You select the changes that belong together.
This refers to commit history.
You review the checkpoints already stored in the repository.
This refers to remote repositories.
You compare the local history with GitHub or another remote location.
The full model looks like this:
Working directory
↓ select changes
Staging area
↓ create checkpoint
Local commit history
↓ share commits
Remote repositoryIf you understand this sequence, commands such as add, commit, and push become much less mysterious.
Saving changes the working file.
Git records the change only after it is staged and committed.
Git is the version-control system.
GitHub is a hosting and collaboration platform built around Git repositories.
A commit records changes locally.
A push sends local commits to a remote repository.
The staging area allows you to select only related changes.
A branch is a separate line of commit history, not a manually duplicated project directory.
A private repository reduces visibility but is not a proper secret-management system.
Credentials should still be excluded and protected.
Git shows differences and history.
It cannot determine whether the implementation is correct, secure, or appropriate.
When using Git with AI coding tools, create commits at meaningful points.
Useful times to commit include:
Avoid waiting until the end of the day to create one enormous commit containing unrelated work.
A clearer history might look like:
Create initial project structure
Add task input form
Store tasks in memory
Add empty-state message
Fix duplicate task submission
Document local setupThis sequence is easier to review and recover than:
Finish appBefore moving to the command tutorial, make sure you can explain the following in your own words:
You do not need perfect terminology yet. You need a clear picture of how a change moves from an edited file into project history.
Git works by separating current work from recorded history.
You edit files in the working directory. You select relevant changes in the staging area. You create commits in the local repository. You use branches when work needs its own line of development. You push commits when you want to share them with a remote repository such as GitHub.
The most important distinction is that saving a file is not the same as recording a checkpoint.
For vibe coding, this distinction is essential. AI tools can make changes quickly, but Git gives you a controlled way to inspect, organize, and reverse those changes.
The next article will turn this mental model into a practical workflow using essential commands such as clone, status, add, commit, log, push, and pull.
No.
Git can track files and create commits entirely on your computer. GitHub is useful when you want an online remote repository, collaboration features, or off-device project history.
No.
Git detects changes, but you choose which files to stage and commit. Files can also be excluded using .gitignore.
Create a commit when one small, meaningful unit of work is complete and verified.
In AI-assisted development, committing before a risky change and after a successful result creates useful recovery points.
Comments
Post a Comment