1

I have a sub-directory in my repo that stopped tracking changes. I can add abc.php file to any directory above a certain level and git status returns the expected results, but once I add abc.php to the subdirectory in question (or change an existing file), git status comes up empty. I believe the subdirectory used to have it's own git repo, but I could be wrong.

I see that git update-index --really-refresh may be an option, but I'm concerned because I added other git projects to "sibling" directories to the one having an issue. (I didn't do anything within my parent repo to acknowledge these, so hope that's okay too.)

That is, I have

  1. ...dir/custom (the dir where changes ignored)
  2. ...dir/sibling1 (sibling dir 1 with own git repo)
  3. ...dir/sibling2 (sibling dir 2 with own git repo)

Every parent directory in dir and above has no issues and works as expected.

My primary question: should I be concerned about running this given the above structure? I'd also like to ask if there's anything I should do with the repos within the primary repo (i.e. somehow declare them as submodules)?

Thanks.

Community
  • 1
  • 1
Webdrips
  • 265
  • 2
  • 17
  • Is there any `.gitignore` file that specifies the custom directory? Is there a `.git` subdirectory in the custom directory? (Use `ls -a` to show the hidden names beginning with dot.) – Eamonn O'Brien-Strain Nov 28 '12 at 06:55
  • I should have mentioned that neither one of those is the case, although again, it's possible the directory used to contain a .git dir that was removed. – Webdrips Nov 28 '12 at 07:09
  • Is there by any chance a `.gitmodules` file at the top level of your repo? – Eamonn O'Brien-Strain Nov 28 '12 at 07:18
  • No that's not the case either; I checked through the issues here too: http://stackoverflow.com/questions/1084969/unable-to-track-files-within-git-submodules – Webdrips Nov 28 '12 at 07:28

2 Answers2

2

Okay well I needed to run the following two commands to get it working:

git rm --cached path_to_subdir (no trailing slash)

git add path_to_subdir/*

Based on the messaging I was seeing when trying to run the command in my original post (git update-index --really-refresh), there used to be a git repo in the sub-directory that was not removed properly, and was never declared as a sub-module.

Community
  • 1
  • 1
Webdrips
  • 265
  • 2
  • 17
0

2 possibilities:

  • Either the directory itself is ignored (in a .gitignore file in any parent directory)
  • Or there is a .git directory within the ignored directory, making it a nested git repo (whose status will be ignored by the parent repo).
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250