Is there a way to include files specifically excluded by a projects .gitignore file? Similar to how .git/info/exclude listings exclude files while not being under version control I want to revert exclusions done by .gitignore so I can see changes in these files.
Asked
Active
Viewed 367 times
1
-
Possible duplicate of [How do negated patterns work in .gitignore?](http://stackoverflow.com/questions/2820255/how-do-negated-patterns-work-in-gitignore) – 1615903 Nov 16 '16 at 05:13
-
1@Ben Nelson, have you get the answer what you want? If yes, please mark it, and it will help for latecomers :) – Marina Liu Nov 24 '16 at 06:41
2 Answers
1
Yes: just add them (edit: with git add -f
). The ignore specs only apply when scanning for untracked files (or when explicitly working with the ignore criteria, git ls-files
can e.g. show you tracked files that match ignore criteria).

jthill
- 55,082
- 5
- 77
- 137
-
actually, that might not be 100% what i'm looking for. i more want to list files as untracked since they are not things i necessarily want to include in my commit but i want to be notified of their presence in the repository. sorry on the confusion! – nobody Nov 16 '16 at 03:01
-
1You can list files matching any pattern(s) you want, `git ls-files` has an `--exclude-per-directory` feature that allows you to construct and track arbitrary `.gitignore`-style selections for file names, you can use them yourself any way you want, but `git status` and such only use the standard exclusions. – jthill Nov 16 '16 at 03:11
1
Excluding files in .gitignore
, there are four status of files:
- Untracked
- deleted
- staged but modified
- staged with no changes
so you can use git ls-files -o
to view untracked files, git ls-files -d
to view deleted files by the last operation, git ls-files -m
to view modified files, and git ls-files -s
to view files have been staged

Marina Liu
- 36,876
- 5
- 61
- 74