我运行了“ git status”,下面列出了一些已修改的文件/或在“未暂存提交的更改”标题下。它还列出了一些我想忽略的未跟踪文件(这些目录中有一个“ .gitignore”文件)。
我想将已修改的文件放在暂存中,以便我可以提交它们。当我运行“ git add。”时,它添加了修改后的文件以及我要忽略的文件。
如果显示以下git状态,我如何仅添加修改后的文件而忽略未跟踪的文件。
另外,我的“ .gitignore”文件是否正常工作?
$ git status
# On branch addLocation
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: someProject/path/domain/viewer/LocationDO.java
# modified: someProject/path/service/ld/LdService.java
# modified: someProject/path/service/ld/LdServiceImpl.java
# modified: someProject/path/web/jsf/viewer/LocationFormAction.java
# modified: someProject/war/WEB-INF/classes/message/viewer/viewer.properties
# modified: someProject/war/page/viewer/searchForm.xhtml
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .metadata/
# someProject/build/
no changes added to commit (use "git add" and/or "git commit -a")
1
如果您在跟踪文件后添加了.gitignore文件,则.gitignore文件将不会忽略已被跟踪的文件。那可能是个问题。
—
BKSpurgeon '16