0
0
Gitdevops~3 mins

Untracked vs tracked files in Git - When to Use Which

Choose your learning style9 modes available
The Big Idea

Ever lost track of which files you changed or added? Git's tracked vs untracked files solve that headache!

The Scenario

Imagine you are working on a project and you keep adding new files or changing existing ones. Without a system to keep track, you might forget which files are new, which ones you changed, or which ones you want to save permanently.

The Problem

Manually remembering or listing all new and changed files is slow and confusing. You might accidentally lose important changes or include files you didn't want to share. This leads to mistakes and wasted time.

The Solution

Git automatically separates files into tracked and untracked. Tracked files are those Git knows about and monitors for changes. Untracked files are new files Git hasn't seen yet. This clear separation helps you manage your work easily and safely.

Before vs After
Before
ls -l
# Then try to remember which files are new or changed
After
git status
# Shows tracked files with changes and untracked new files clearly
What It Enables

This concept lets you confidently manage your project files, knowing exactly what is saved and what is new, avoiding mistakes and saving time.

Real Life Example

When you add a new image or script to your project folder, Git shows it as untracked. You decide when to add it to tracking, so you don't accidentally share unfinished or unwanted files.

Key Takeaways

Tracked files are those Git monitors for changes.

Untracked files are new files Git hasn't started tracking yet.

Knowing this helps you manage your project safely and efficiently.