Why isnโ€™t Git tracking changes in a subdirectory?

I created a git repository, added the code, and clicked it on GitHub.

Then, locally, I edited the Eila.Analyser/Program.cs file, which was added to GitHub in the first commit, saved, and git status says there are no changes.

Well, I think something must have messed up, git reset --hard HEAD , and as I understand it, this should return everything, but my file will not return.

So, I think I'm doing something wrong. I am editing a file in the root folder, git status - shows that there are changes, it works as a suspect, so it works with files in the root folder, but not in subfolders.

Did I miss something obvious here?

UPDATE: proof that the file I'm editing was really perfect ( git log --stat ):

enter image description here

If this helps, the tree image:

enter image description here

UPDATE2: Well, it seemed to me that I really messed up something, so I deleted the folder where my solution was, cloned gitHub again, and my local code is still different from the existing one in gitHub and git status sees no change, git log origin/master..HEAD gives nothing.

+9
source share
7 answers

So finally it worked. I deleted the changed files in the local folder, and then git status began to see that these files are missing. Therefore, I restored them and git status began to see that the files were changed.

+8
source

Try running git update-index --really-refresh .

I had similar problems on Windows and it solves.

You should also check the core.ignoreStat option with git config .

+11
source

Sometimes I have the same problem, especially when I have a subfolder that is another git repo. Solution: rename folders. Try switching the folder name to another. Pin it and then rename it back. If the subfolder itself is another git repo, and you want it to be completely separate from the main stream after your repo, you must first remove the remote access to this subfolder.

+6
source

For me, the solution was

Rename an untracked folder

+3
source

For me, the problem was that in my .gitignore file there was a file name that was not there. Removing this invalid file name from .gitignore solved the problem. In addition, I deleted all .gitignore files from subdirectories and saved only the top level .gitignore file.

0
source

PROBLEM (in my case)
Running git checkout -b <branch_name> had no effect, and my folder and files in this branch were still not visible locally, although they are on our gitlab server.

DECISION
I copied the SHA hash of the last commit in this branch, then locally:

git checkout -b <branch_name> #SHA Hash

Now I see the expected subdirectories and files.

0
source

I had the same problem. The Giedrius solution worked for me too; I deleted the entire directory and added it again. This fixed the problem.

-one
source

Source: https://habr.com/ru/post/1393370/


All Articles