Reputation: 2443
My system is centos 7.4 with git 1.8.3
When I want to list all files not tracked by git:
[root@localhost www]# git ls-files --others --exclude-standard
[root@localhost www]# git status
# On branch test
nothing to commit, working directory clean
It seemed nothing is non_tracked.
Then I run git clean -fdxn
,output as below:
[root@localhost www]# git clean -fdxn
Would remove cms/template/
Would remove cms/tool/feedback/temp/
Would remove cms/update/
Would remove html/
Would remove images/
Would remove index.html
Would remove nbproject/
Would remove admin/application/config/config.php
Would remove welcome.html
We can see lots of folders and files not_tracked.
That's right,because those folders and files are listed in .gitignore
.
I am confused.
For example, welcome.html
is output of git clean -fdxn
,which means welcome.html
is not tracked.
Why doesn't git ls-files --others --exclude-standard
output welcome.html
?
Upvotes: 2
Views: 3222
Reputation: 94483
git ls-files --others --exclude-standard
outputs no files because there are no files that are untracked and not ignored. Add a file that doesn't correspond to any pattern in .gitignore
and retry — the file will be in the output.
To see all untracked files including ignored run simple git ls-files --others
.
Upvotes: 2