Git command to show which specific files are ignored by .gitignore

后端 未结 9 1332
我在风中等你
我在风中等你 2020-11-22 05:07

I am getting my feet wet with Git and have the following issue:

My project source tree:

/
|
+--src/
+----refs/
+----...
|
+--vendor/
+----...
         


        
9条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 06:05

    Another option that's pretty clean (No pun intended.):

    git clean -ndX
    

    Explanation:

    $ git help clean
    
    git-clean - Remove untracked files from the working tree
    -n, --dry-run - Don't actually remove anything, just show what would be done.
    -d - Remove untracked directories in addition to untracked files.
    -X - Remove only files ignored by Git.
    

    Note: This solution will not show ignored files that have already been removed.

提交回复
热议问题