MD004
MD004

Reputation: 600

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

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.

Upvotes: 4

Views: 282

Answers (2)

user837730
user837730

Reputation:

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)

Upvotes: 2

doliver
doliver

Reputation: 998

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

Upvotes: 2

Related Questions