More about Tracking Files
When working with Git, files in your project directory can be either tracked or untracked. Tracked files are included in snapshots (future commits), while untracked files are not. Newly created files are typically untracked until added to the staging area.
Tracked files can exist in three states:
- Modified; changes have been made, but Git has not stored them yet;
- Staged; changes are prepared to be committed and included in the next snapshot;
- Committed; changes are saved in a snapshot inside the
.git
directory.
Use the following image to illustrate these states clearly.

If a file is already tracked and changes are made to it, you must run the git add
command to stage those modifications.
Modify the test.txt
file using the following command:
The >>
operator appends the text enclosed in double or single quotes to an existing file, in this case test.txt
.
The text is added at the end of the file on a new line.

Now the file has a modified status.
Use the git add
, git status
, and git commit
commands to stage the change, check the status of the working tree and staging area, and commit the change, respectively:

As you can see, the changes are now staged, and a new snapshot of the project has been created by committing the staged changes.
Thanks for your feedback!
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain the difference between staged and committed files in Git?
What happens if I modify a file after staging it but before committing?
How can I see which files are modified, staged, or committed?
Awesome!
Completion rate improved to 3.57
More about Tracking Files
Swipe to show menu
When working with Git, files in your project directory can be either tracked or untracked. Tracked files are included in snapshots (future commits), while untracked files are not. Newly created files are typically untracked until added to the staging area.
Tracked files can exist in three states:
- Modified; changes have been made, but Git has not stored them yet;
- Staged; changes are prepared to be committed and included in the next snapshot;
- Committed; changes are saved in a snapshot inside the
.git
directory.
Use the following image to illustrate these states clearly.

If a file is already tracked and changes are made to it, you must run the git add
command to stage those modifications.
Modify the test.txt
file using the following command:
The >>
operator appends the text enclosed in double or single quotes to an existing file, in this case test.txt
.
The text is added at the end of the file on a new line.

Now the file has a modified status.
Use the git add
, git status
, and git commit
commands to stage the change, check the status of the working tree and staging area, and commit the change, respectively:

As you can see, the changes are now staged, and a new snapshot of the project has been created by committing the staged changes.
Thanks for your feedback!