github changes not staged for commit

后端 未结 13 696
[愿得一人]
[愿得一人] 2020-12-23 13:31

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

13条回答
  •  旧时难觅i
    2020-12-23 14:02

    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

提交回复
热议问题