【问题标题】:Commit in Github在 Github 中提交
【发布时间】:2023-03-29 22:50:01
【问题描述】:

我使用以下命令:

git add *
git commit -am 'updating'

我在下面遇到了:

# 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:   webkomiks (modified content)
#
no changes added to commit (use "git add" and/or "git commit -a")

我应该怎么做?

我继续:

git push myrep master

我只看到了 github 中的文件夹,没有看到文件夹中的文件。

谢谢

【问题讨论】:

  • 你是在项目根目录下git add .吗?此外,对于跟踪文件,只需 git commit -am"Updating" 就足够了,因为 -a 选项会添加所有跟踪文件。
  • 是的,在根目录中。应该在哪里?
  • 实际上 - webcomiks 是一个子模块吗?您可以使用命令git submodule status 进行检查,如果出现则它是一个子模块。

标签: git github add git-commit


【解决方案1】:

您没有递归提交到子目录。

尝试git add . 而不是git add *

【讨论】:

    【解决方案2】:

    webcomiks 有可能是一个子模块吗?

    如果是这样,那么您需要进入子模块目录,提交并推送该子模块中的更改,然后转到主存储库并从那里提交。

    【讨论】:

    • 我试过git submodule status,它说:在.gitmodules 中找不到路径'webkomiks'的子模块映射
    【解决方案3】:

    webkomiks 是目录还是文件或其他什么?

    如果你想添加 webkomiks,正如 Johan Paul 所说,运行 'git add webkomiks'

    试试git clean -n,它应该会给你更多信息。如果它是一个目录,它会说“不会删除”。当然你可以通过添加 '-d' 选项来移除它。

    【讨论】:

      【解决方案4】:

      如错误消息所述:

       Changes not staged for commit:
       ...
       modified:   webkomiks (modified content)
      

      这可能是一个目录?这不包括在提交中。 git add webkomiks 也是如此,然后再试一次。

      【讨论】:

      • git 不知道目录,所以它不能是目录
      猜你喜欢
      • 2019-10-27
      • 2011-12-10
      • 2011-06-14
      • 2015-02-22
      • 2016-03-01
      • 1970-01-01
      • 2017-05-09
      • 2012-01-12
      • 2018-11-28
      相关资源
      最近更新 更多