Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git error: Changes not staged for commit

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

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.

UPDATE2: The strusture of my project is:

enter image description here

I added submodule as

git submodule update -i
like image 999
Voloda2 Avatar asked Dec 13 '11 12:12

Voloda2


People also ask

Why does git say changes not staged for commit?

The “changes not staged for commit” message shows when you run the “git status” command and have a file that has been changed but has not yet been added to the staging area. This is not an error message, rather a notification that you have changed files that are not in the staging area or a commit.

How do you handle changes not staged for commit?

Changes to files are not staged if you do not explicitly git add them (and this makes sense). So when you git commit , those changes won't be added since they are not staged. If you want to commit them, you have to stage them first (ie. git add ).

Why my git commit is not working?

Your answer This occurs because you might have git directories in other folders as well.


1 Answers

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

like image 184
BenC Avatar answered Oct 04 '22 17:10

BenC