最佳答案
我运行了“git状态”,下面列出了一些被修改/或在标题“未为提交暂存的更改”下的文件。它还列出了一些我想忽略的未跟踪文件(我在这些目录中有一个“. 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")