gpt4 book ai didi

git:停止警告我有关子模块的更改

转载 作者:太空狗 更新时间:2023-10-29 14:30:12 24 4
gpt4 key购买 nike

我有一个 git 子模块,它在 git status 中不断显示“已修改”,即使我从未更新过它也是如此。

# On branch master
# 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)
# (commit or discard the untracked or modified content in submodules)
#
# modified: MKNetworkKit (new commits, untracked content)
#

如何阻止 git 考虑它?我尝试将 MKNetworkKit 添加到 .gitignore,但它没有做任何事情。

最佳答案

只需添加:

git status --ignore-submodules

问题“How to get rid of git submodules untracked status?”提出了一种更永久的方式来掩盖该状态,但如果您暂时 stash 该信息,--ignore-submodules就够了。

来自 git status man page :

--ignore-submodules[=<when>]

Ignore changes to submodules when looking for changes.
<when> can be either "none", "untracked", "dirty" or "all", which is the default.

  • Using "none" will consider the submodule modified when it either contains untracked or modified files or its HEAD differs from the commit recorded in the superproject and can be used to override any settings of the ignore option in git-config(1) or gitmodules(5).
  • When "untracked" is used submodules are not considered dirty when they only contain untracked content (but they are still scanned for modified content).
  • Using "dirty" ignores all changes to the work tree of submodules, only changes to the commits stored in the superproject are shown (this was the behavior before 1.7.0).
  • Using "all" hides all changes to submodules (and suppresses the output of submodule summaries when the config option status.submodulesummary is set).

关于git:停止警告我有关子模块的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17982587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com