修改后的文件出现在 Git 中但没有更新的问题?

发布于 2024-10-20 08:06:50 字数 812 浏览 5 评论 0原文

我有一些文件/文件夹不会离开 Git 暂存区域?

# On branch master
# Changed but not updated:
#   (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:   JavaScript/Stand.ard.iz.er (modified content, untracked content)
#   modified:   Site (untracked content)
#   modified:   Template Archives/Template (modified content, untracked content)
#   modified:   Template Archives/Template_Git (modified content, untracked content)
#

我已经尝试了一切来提交这些“修改”的文件,但没有运气?

我已经尝试过了……

git add .
git add *
git add -u
git add {actual full directory path}

但都不起作用。

有什么想法吗?

谢谢。

I've got some files/folders that just wont leave the Git staging area?

# On branch master
# Changed but not updated:
#   (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:   JavaScript/Stand.ard.iz.er (modified content, untracked content)
#   modified:   Site (untracked content)
#   modified:   Template Archives/Template (modified content, untracked content)
#   modified:   Template Archives/Template_Git (modified content, untracked content)
#

I've tried everything to get these 'modified' files commited but with no luck?

I've tried...

git add .
git add *
git add -u
git add {actual full directory path}

...but none of it works.

Any ideas?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

给不了的爱 2024-10-27 08:06:50

这些可能是子模块,在这种情况下,它们的状态将从父存储库的状态中显示。

除非您使用 git 状态

查找更改时忽略子模块的更改。
可以是“none”、“untracked”、“dirty”或“全部”,这是默认值。

  • 使用“none”会在子模块包含未跟踪或修改的文件或其 HEAD 与记录中记录的提交不同时认为子模块已修改超级项目,可用于覆盖 git-configgitmodules
  • 当使用“untracked”时,如果子模块仅包含未跟踪的内容(但仍会扫描它们以查找修改的内容),则不会将其视为脏模块。
  • 使用“dirty”会忽略对子模块工作树的所有更改,仅显示对存储在超级项目中的提交的更改(这是 1.7 之前的行为)。 0)。
  • 使用“all”会隐藏对子模块的所有更改(并在配置选项 status.submodulesummary 已设置)。


在任何情况下,您都需要从子模块本身内部添加和提交,然后才能上升一级(在父存储库级别)并查看干净状态。

Those could be submodules, in which case their status would be displayed from the status of the parent repo.

Unless, that is, you use the --ignore-submodules[=<when>] option of git status:

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 or gitmodules.
  • 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).

In any case, you would need to add and commit from within the submodules themselves, before being able to go up one level (at the parent repo level), and see clean status.

笨死的猪 2024-10-27 08:06:50

如果您将一些新文件夹复制到项目中,并且其中已经有 .git 文件夹,则可能会发生这种情况。所以它就像主存储库中的子存储库。解决方案只需删除新复制的子文件夹中的 .git 文件夹即可。

This could happend if you've copy some new folder to your project which have already a .git folder inside. So it will be like a sub repository in your main repository. The solution is just delete this .git folder in your new copied sub folder.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文