Search code examples
gitversion-controlversionversioning

Opposite of .git/info/exclude - including files that are excluded by .gitignore


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.


Solution

  • Excluding files in .gitignore, there are four statuses of files:

    1. Untracked
    2. deleted
    3. staged but modified
    4. staged with no changes

    so you can use:
    git ls-files -o to list untracked files
    git ls-files -d to list deleted files by the last operation
    git ls-files -m to list modified files
    ??? to list files have been staged