[git] github changes not staged for commit

I have a very basic github setup with a readme, a directory, and another directory inside it with an html file. On github I can only view the readme and the first folder but none of its contents, and I am getting this message

tc349 ryntc3$ git add *
tc349 ryntc3$ 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:   week1 (modified content)

no changes added to commit (use "git add" and/or "git commit -a")

I feel like if I am adding all to be staged that it should not be an issue. Any help?

This question is related to git github

The answer is


I kept receiving the same message no matter what i did.

To fix this, i removed .gitignore and i am not getting the Github changes not staged for commit message anymore. Before it would allow me to commit once when i ran git add . and then after it would bring up the same message.

Im not sure why the .gitignore file was causing a problem but i added on my local machine and most likely didn't sync it up properly.


I was having the same problem. I ended up going into the subdirectory that was "not staged for commit" and adding, committing and pushing from there. after that, went up one level to master directory and was able to push correctly.


WARNING! THIS WILL DELETE THE ENTIRE GIT HISTORY FOR YOUR SUBMODULE. ONLY DO THIS IF YOU CREATED THE SUBMODULE BY ACCIDENT. CERTAINLY NOT WHAT YOU WANT TO DO IN MOST CASES.

In my situation, there was a sub-directory which had a .git directory.

What I do is simply remove that .git directory from my sub-directory.


In my case the problem was the subfolder that I was tying to push was a git folder itself

So I did the following

  1. Go inside the subfolder that you want to push and run this:
rm -rf .git
  1. Then run this:
 git rm --cached <subfolderName>
  1. Then come to main project folder and run this (make sure to add / after folder name)
    git add <folderName>/
    git commit -m "Commit message"
    git push -f origin <branchName>


For me, I had to commit the subdirectories which had .git in it since both the parent and the subfolder have remotes to push to. And then commit and push the parent directory.


WARNING! THIS WILL DELETE THE ENTIRE GIT HISTORY FOR YOUR SUBMODULE. ONLY DO THIS IF YOU CREATED THE SUBMODULE BY ACCIDENT. CERTAINLY NOT WHAT YOU WANT TO DO IN MOST CASES.

I think you have to go inside week1 folder and delete the .git folder:

sudo rm -Rf .git

then go back to top level folder and do:

git add .

then do a commit and push the code.


If it's a submodule you need to cd into it then use git add . && git commit -m 'Your message'

From there you can cd out and push to whichever branch you want.


in my case, I needed a

 git add files
 git commit -am 'what I changed'
 git push

the 'a' on the commit was needed.


I tried everything suggested on whole Stackoverflow. Nothing including -a or -am or anything helped.

If you are the same, do this.

So, the problem is, git thinks some of your subdirectory is sub-project in your root-project. At least, in my case it wasn't like that. It was just regular sub-directory. Not individual project.

Move that regular sub-directory which is not being pushed at some temporary location.

Remove the hidden .git folder from that directory.

cd to the root directory.

git init again.

git add . again.

git commit -m "removed notPushableDirectory temporarily"

git push -f origin master

We will have to force it as the git will see the conflict between remote git and your local structure. Remember, we created this conflict. So, don't worry about forcing it.

Now, it will push that sub-directory as sub-directory and not as sub-module or sub-project inside your root-project.


Have you tried

git add .

This recurses into sub-directories, whereas I don't think * does.

See here


Believe this occurs because you have a child repository "submodule" that has changes which have not been staged and committed.

Had a similar problem, where my IDE kept reporting uncommitted changes, and running the stage (git add .) and commit (git commit -m "message") commands had no effect. Thinking about this in hindsight, it's probably because the child repository had the changes that needed to be staged and committed, not the parent repository.

Steps that fixed the issue

  1. cd into the submodule (has a hidden folder named .git) and execute the commands to stage (git add .) and commit (git commit -m "Update child repo")
  2. cd .. back to the parent repo, and execute the commands to stage (git add .) and commit (git commit -m "Update parent repo")

Advice that wasn't helpful

  • sudo rm -Rf .git == DO NOT USE THIS COMMAND == it permanently deletes submodule repository history (the purpose of GIT)
  • git add -A === Added untracked files, but didn't fix issue

This command may solve the problem :

git add -A

All the files and subdirectories will be added to be tracked.

Hope it helps