Problem with modified files showing up in Git but not updating?

雨燕双飞 提交于 2019-12-22 04:04:45

问题


I've got some files/folders that just wont leave the Git staging area?

# On branch master
# Changed but not updated:
#   (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:   JavaScript/Stand.ard.iz.er (modified content, untracked content)
#   modified:   Site (untracked content)
#   modified:   Template Archives/Template (modified content, untracked content)
#   modified:   Template Archives/Template_Git (modified content, untracked content)
#

I've tried everything to get these 'modified' files commited but with no luck?

I've tried...

git add .
git add *
git add -u
git add {actual full directory path}

...but none of it works.

Any ideas?

Thanks.


回答1:


Those could be submodules, in which case their status would be displayed from the status of the parent repo.

Unless, that is, you use the --ignore-submodules[=<when>] option of git status:

Ignore changes to submodules when looking for changes.
<when> can be either "none", "untracked", "dirty" or "all", which is the default.

  • Using "none" will consider the submodule modified when it either contains untracked or modified files or its HEAD differs from the commit recorded in the superproject and can be used to override any settings of the ignore option in git-config or gitmodules.
  • When "untracked" is used submodules are not considered dirty when they only contain untracked content (but they are still scanned for modified content).
  • Using "dirty" ignores all changes to the work tree of submodules, only changes to the commits stored in the superproject are shown (this was the behavior before 1.7.0).
  • Using "all" hides all changes to submodules (and suppresses the output of submodule summaries when the config option status.submodulesummary is set).

In any case, you would need to add and commit from within the submodules themselves, before being able to go up one level (at the parent repo level), and see clean status.




回答2:


This could happend if you've copy some new folder to your project which have already a .git folder inside. So it will be like a sub repository in your main repository. The solution is just delete this .git folder in your new copied sub folder.



来源:https://stackoverflow.com/questions/5186371/problem-with-modified-files-showing-up-in-git-but-not-updating

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!