简体   繁体   中英

git: changes ignored in sub-directory

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 (ie somehow declare them as submodules)?

Thanks.

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.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM