DEV Community

Surhid Amatya
Surhid Amatya

Posted on

4 1

Files added to .gitignore is still being showed untracked file

There is a file that was being tracked by git, but now the file should not be tracked and is added on the .gitignore list.

However, that file keeps showing up in git status after it's edited. How do we force git to completely forget about it and stop tracking it?

To stop tracking the files we need to remove that file from the index.

To achieve this git has provided us with some commands as listed below:

To untrack a single file

git rm --cached filename

To untrack every file

git rm -r - cached .

this code removes any changed files from the index, after this code run

git add .

Now, it's time to commit the changes;

 git commit -m "update .gitignore file"

These mentioned codes will update the .gitignore file but what if we had added the wrong file or if we need to track some files again.

Undo

git rm --cached filename

use

git add filename

to track this file again.
Hope this will help us all.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more