Git: Commit changes

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


Let’s see how a file can be added to Git. Type:

echo "Test" > README.txt

to create a file. The file is now in the directory, but Git was not told to add it to its index, as you can see what git status tells us:

Adding files to a repository

Now we need to add the file to the repository with:

git add README.txt

This command adds the file to the staging area:

Add the file to the staging area

Once a file is in the staging area, you can remove it by typing:

git reset README.txt

But usually what you do once you add a file is commit it.

Once you have one or more changes to the staging area, you can commit them using

git commit -am "Description of the change"

Commit changes

This cleans the status of the staging area:

Commit changes status

and permanently stores the edit you made into a record store, which you can inspect by typing git log:

Run git log

Lessons in this unit:

0: Introduction
1: Installing Git
2: Initialize a repository
3: ▶︎ Commit changes
4: Branches
5: Push and pull
6: Working with a remote
7: Solving conflicts
8: .gitignore
9: How to add a Git remote
10: How to remove a Git remote
11: How to set GitHub credentials for macOS