为什么不在子目录中更改Git跟踪? [英] Why isn't Git tracking changes in a subdirectory?

查看:139
本文介绍了为什么不在子目录中更改Git跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了git存储库,添加了代码并将其推送到GitHub。

然后在本地编辑文件 Eila.Analyser / Program.cs ,它被添加到GitHub在第一次提交时,保存它并且 git status 表示没有变化。



好的,我认为,一定是搞砸了, git reset --hard HEAD ,据我了解这应该恢复一切,但我的文件不会恢复。



所以我认为我做错了什么。我编辑根文件夹中的文件, git status - 显示有变化,可以工作,因此它可用于根文件夹中的文件,但不用于子文件夹。



我在这里丢失了一些明显的东西吗?

更新:证据,我正在编辑的文件是真正提交的( git log --stat ):


如果有帮助,树图:



jlJB8.pngalt =在这里输入图片描述



UPDATE2:好的,我以为我真的搞砸了,所以我删除了文件夹,我的解决方案在哪里,再次从gitHub克隆,我的本地代码仍然不同于gitHub中的现有代码,并且git状态没有发生变化, git log origin / master..HEAD 什么都没有。

解决方案

我已经删除了本地文件夹中的更改文件 - 然后突然 git status 开始查看这些文件丢失。所以我已经恢复它们并且 git status 开始看到,那些文件被修改了。


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

if it helps, tree picture:

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.

解决方案

So finally it worked. I've removed changed files in local folder - then suddenly git status started to see, that those files are missing. So I've restored them and git status started to see, that files are modified.

这篇关于为什么不在子目录中更改Git跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆