繁体   English   中英

如何不在git中暂存未跟踪的文件?

[英]How not to stage the untracked files in git?

在我得到status ,它会在控制台中这样打印。

$ git status
On branch easy_buy_and_sell
Your branch is up-to-date with 'origin/easy_buy_and_sell'.
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:  xyz/src/main/java/com/draglet/domain/order/LocalOrderImpl.java

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        log/
        production/

no changes added to commit (use "git add" and/or "git commit -a")

现在,当我执行git add . ,它暂存了log/production/文件夹中的所有文件。 对于不暂存未跟踪的文件该怎么办?

而不是使用git add . 使用git add draglet-common/src/main/java/com/draglet/domain/order/LocalOrderImpl.java

因为git add . 在工作目录中暂存所有文件。

您可以使用git add path/to/file1 path/to/file2单个文件

您可以使用git add -u path/to/file1 path/to/file2修改和删除的文件。

暂无
暂无

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

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