dms
dms

Reputation: 139

How do I limit the number of untracked files being listed in a git status?

I have updated some resources using a console command and now I have 2039 new image files that are untracked and that are appearing when I use the command git status. Because they are untracked, I believe a gitignore won't do a thing since they're already ignored, so how can I do this on git?

They're all in the folder frontend/www/site-resources/product/media/ folder.

Upvotes: 0

Views: 221

Answers (2)

Daniel H
Daniel H

Reputation: 7463

An untracked file is a file that Git doesn’t store the status of. An ignored file is a file that Git by default won’t care about: it won’t mention them when you run git status, it won’t add them when you run git add -A, etc.

Your files are untracked, in that they aren’t in the repository itself (only the folder with the repository), but they aren’t ignored or you wouldn’t have this problem. This is exactly what the .gitignore file is for: you can set it to ignore *.png (or whatever the extension of your images is), and it won’t report them.

If your files are properly ignored, then even running git add frontend/www/site-resources/product/media/ won’t add them; you’d need to name the individual files on the command line.

Upvotes: 0

Wojtek
Wojtek

Reputation: 439

Git sees every file in your working copy as one of three things:

  • tracked - a file which has been previously staged or committed;
  • untracked - a file which has not been staged or committed; or ignored
  • a file which Git has been explicitly told to ignore.

If I understand your question correctly, you want some untracked files to disappear from your status, therefore you want Git to ignore these files.

Since they are all in one folder you can use this solution.

Upvotes: 2

Related Questions