好的,这可能是一个愚蠢的问题,但我是git新手,经常感到困惑。
我在IntelliJ上创建了一些文件,现在当我在我的IntelliJ终端中运行git status
时,我得到了以下结果:
Changes to be committed:
(use "git restore --staged <file>..." to unstage)
new file: file x
new file: file y
new file: file z
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
Modified: file x
Modified: file y
Modified: file z
Untracked files:
(use "git add <file>..." to include in what will be committed)
file a
file b
我想暂存并提交文件x、文件y和文件z,但不想暂存文件a和文件b。
我知道
git add .
会暂存所有已跟踪和未跟踪的文件。是否可以使用git add -u
来完成这项工作?注意:有很多文件,我不想逐个添加它们。
git add -u
做了你所描述的操作。更多信息请参考这里:https://dev59.com/FXI95IYBdhLWcg3wtwRe#2190431 - Adil Bgit add -u
命令将会将任何你已经从仓库中删除但Git正在跟踪的文件也添加到暂存区。当你提交时,Git将会从仓库中删除这些文件。 - Adil B修改:文件x 修改:文件y 修改:文件z 删除:文件K
- Adil B