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

时光总嘲笑我的痴心妄想 提交于 2020-01-05 03:43:09

问题


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.


回答1:


Excluding files in .gitignore, there are four status of files:

  1. Untracked
  2. deleted
  3. staged but modified
  4. 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




回答2:


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).



来源:https://stackoverflow.com/questions/40619353/opposite-of-git-info-exclude-including-files-that-are-excluded-by-gitignore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!