I am getting my feet wet with Git and have the following issue:
My project source tree:
/
|
+--src/
+----refs/
+----...
|
+--vendor/
+----...
It should be sufficient to use
git ls-files --others -i --exclude-standard
as that covers everything covered by
git ls-files --others -i --exclude-from=.git/info/exclude
therefore the latter is redundant.
~/.gitconfig
file:
git config --global alias.ignored "ls-files --others -i --exclude-standard"
Now you can just type git ignored
to see the list. Much easier to remember, and faster to type.
If you prefer the more succinct display of Jason Geng's solution, you can add an alias for that like this:
git config --global alias.ignored "status --ignored -s"
However the more verbose output is more useful for troubleshooting problems with your .gitignore files, as it lists every single cotton-pickin' file that is ignored. You would normally pipe the results through grep
to see if a file you expect to be ignored is in there, or if a file you don't want to be ignore is in there.
git ignored | grep some-file-that-isnt-being-ignored-properly
Then, when you just want to see a short display, it's easy enough to remember and type
git status --ignored
(The -s
can normally be left off.)