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

2

9

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.

Floriated answered 3/3, 2011 at 20:49 Comment(0)
R
14

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.

Riata answered 3/3, 2011 at 20:57 Comment(3)
So if they keep showing up as modified, how do I clean their "modified content" off my repo?Zamora
@Trip: by going in that submodule, perform the git add . there, commit, then go back up to the parent repo: a git status will show a clean state.Riata
@Vonc I followed your instructions and now a git status on the parent shows bundle/supertab (new commits). If I just go back, I found that git status doesn't show the modified content, but if I try to commit I still see modified: bundle/supertab (modified content). Do you know if I can get rid of that?Loco
E
11

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.

Elyot answered 8/3, 2011 at 2:12 Comment(2)
Except that after deleting the .git folder any changes made in this folder will NOT be tracked by the parent repo. At least that's how it is in git v1.8.3.1 I'm using.Cantor
You also need to do git rm --cached submodule_path # delete reference to submodule HEAD (no trailing slash) to make forget about this submodule.Cantor

© 2022 - 2024 — McMap. All rights reserved.