繁体   English   中英

如何暂存所有跟踪的修改文件?

[英]How to stage all tracked modified files?

好的,这可能是一个愚蠢的问题,但我是 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 暂存您对当前在整个存储库中跟踪的文件的所有修改,请使用git add -u命令。

有很多文件,我不想单独添加它们。

您可以使用 git 忽略和 git 不会添加这些文件

### .gitignroe
<b full path>

重要提示:不要忘记添加并提交您的.gitignore文件。


如何获取被忽略文件的列表?

git check-ignore -v <path>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM