Git 错误:更改未暂存以进行提交

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8488887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:29:22  来源:igfitidea点击:

Git error: Changes not staged for commit

gitgit-submodules

提问by Voloda2

I have my project + RestKit submodule. Error appeared when I changed RestKit settings. I added support armv6 and armv7 architecture.

我有我的项目 + RestKit 子模块。更改 RestKit 设置时出现错误。我添加了对 armv6 和 armv7 架构的支持。

git add .
git add -u 
git commit -m "new"
# 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:   RestKit (modified content)
#

How to fix this error.

如何修复此错误。

UPDATE: I don't run git add RestKit.

更新:我不运行 git add RestKit。

UPDATE2: The strusture of my project is:

UPDATE2:我的项目的 strusture 是:

enter image description here

在此处输入图片说明

I added submodule as

我添加了子模块作为

git submodule update -i

回答by BenC

You are apparently dealing with a submodule, so you should use the submodule workflow :

您显然正在处理子模块,因此您应该使用子模块工作流程:

# Modification on RestKit, for instance :
cd RestKit
git add .
git commit -m "Support for armv6 & armv7"
cd ..
# RestKit submodule up-to-date, now update your project
git add RestKit
git commit -m "RestKit submodule updated"

You can find more information here.

您可以在此处找到更多信息。

Also : Git Book on Submodules

另外:关于子模块的 Git 书