How do you git show untracked files that do not exist in .gitignore

Git

Git Problem Overview


I'm using git status -u to show untracked files. And on the terminal, I see plenty untracked files that I need to be untracked such as unit tests, personal documentation, etc. I have put them in .gitignore, but it seems that git status still shows them.

How do you show only untracked files that don't exist in .gitignore.

Git Solutions


Solution 1 - Git

You can explicitly list what is being tracked and untracked as follows to see if Git is seeing and honoring your .gitignore. If you post your .gitignore contents, git status output, and dir or ls we can better assist you.

List ignored files
$ git ls-files . --ignored --exclude-standard --others
List untracked files
$ git ls-files . --exclude-standard --others

Solution 2 - Git

Use:

git config status.showuntrackedfiles no 

Solution 3 - Git

git update-index --no-assume-unchanged <file>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjustjoeView Question on Stackoverflow
Solution 1 - GitMatthew McCulloughView Answer on Stackoverflow
Solution 2 - GitOhad SadanView Answer on Stackoverflow
Solution 3 - GitBrooks FolkView Answer on Stackoverflow