如何在 gitignore 中显示对项的更改

  • 本文关键字:显示 gitignore git
  • 更新时间 :
  • 英文 :


我想知道如何显示对 .gitignore 中的项目所做的更改。 所以说,我有一个包含在.gitignore中的文件foo.txt,但我仍然想看看foo.txt是否已添加到我的本地存储库中,尽管没有提交到它。我怎么能看到这个?

git status

如果new: foo.txt出现在Changes to be committed扇区中,则它已被添加但未提交。如果是modified: foo.txt,则已被跟踪,但尚未提交新版本。如果它未以git status显示,但显示在git status --ignored中,则会忽略它并且尚未添加。

git show HEAD:foo.txt

如果它打印文件的内容,则foo.txt已被跟踪。如果它打印fatal: Path 'foo.txt' exists on disk, but not in 'HEAD'.,则不会在当前提交中跟踪它。

git check-ignore -v foo.txt

如果它打印忽略foo.txt的忽略文件,则尚未添加或提交该文件。

最新更新