Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
734 views
in Technique[技术] by (71.8m points)

github - Why isn't Git tracking changes in a subdirectory?

I've created git repository, added code and pushed it to GitHub.

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

Ok, I think, must have messed something up, git reset --hard HEAD, and as I understand that should revert everything, but my file is not reverted.

So I think I'm doing something wrong. I edit file in root folder, git status- shows there are changes, works as suspected, so it works on files in root folder, but not in sub folders.

Am I missing something obvious here?

UPDATE: Evidence, that file I'm editing was really commited (git log --stat):

enter image description here

if it helps, tree picture:

enter image description here

UPDATE2: Ok, I thought I really messed something up, so I've deleted folder, where was my solution, cloned once again from gitHub, and my local code still differs from existing in gitHub and git status sees no changes, git log origin/master..HEAD gives nothing.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Sometimes I have the same problem, especially when I have subfolder which is another git repo itself. The solution is: renaming the folders. Try switching the folder name to something else. Commit that, then rename it back. If the subfolder itself is another Git repo, and you want it to be totally detached from the mainstream, and follow your repo, you should remove the remote of that subfolder first.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...