Stages#
In git, files can take on different states with respect to the current commit. The following picture mention central idea.
Get status#
The git status command allows you to get some information about the current status of the git repository. This command is very common on this site, so you can find many different examples of how to use it.
Untracked files#
If git hasn’t seen a file before, it will correspond to this category. You can find files on this stage in Untracked files section of git status command.
The following cell displays the output of the git status command for the empty repository.
%init
git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
The following cell shows the updated output of the file that was created but not staged.
echo "some text" > test_file
git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
test_file
nothing added to commit but untracked files present (use "git add" to track)
Staged#
In git status they’re shown in the Changes to be committed section.
The following example shows how to createa file and stage it with the git add staged a test_file.
%init
echo "some text" > test_file
git add test_file
git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: test_file
Commited files#
If you just commit all the files and check git status, you will always get the same message. You can also check the list of commits using git log.
The following example creates a commit and shows the output of the git commit in such case.
%init
echo "some text" > test_file
git add test_file
git commit -m "my message" &> /dev/null
git status
On branch master
nothing to commit, working tree clean
The output of git log is listed a commit with its corresponding information.
git log
commit 1649518144d632cc1d46447f8acb1f04b1c3c892 (HEAD -> master)
Author: fedorkobak <kobfedsur@gmail.com>
Date: Mon Oct 27 22:39:38 2025 +0300
my message
Changed#
Any file that has been changed since the last commit will appear in the Changes not staged to commit section, so if you try to commit in this momed, any changes made to these files won’t be committed.
The following cell shows the output for changed file.
%init
echo "some text" > test_file
git add test_file &> /dev/null
git commit -m "first commit" &> /dev/null
echo "some other text" > test_file
git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: test_file
no changes added to commit (use "git add" and/or "git commit -a")