Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git: how to tell if a file or folder is committed versus ignored?

Tags:

git

In Git, how do I tell if a file or folder is committed versus ignored?

That is, I have a folder in the current directory and I don't know if it's been committed, or, if there's a .gitignore somewhere that is ignoring the folder. When I do 'git status' the folder is not listed in any sections.

Secondly, if the folder has been committed, is there an easy way to tell which of its files are committed? For example:

folder contains:
- 0001.csv
- 0002.csv
- ...
- 2000.csv

And I want to list which files have been committed, and which have been ignored.

like image 328
MD004 Avatar asked Sep 17 '25 03:09

MD004


2 Answers

Are you looking for

git status --ignored

?

That will show a result that looks like:

Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

(all added / modified)

Ignored files:
(use "git add -f ..." to include in what will be committed)

(all ignored files)

I think you're looking for git status --ignored

like image 25
doliver Avatar answered Sep 19 '25 19:09

doliver