问题描述
我开始收到这条消息.无论我编辑什么并尝试提交,它都说没有什么可提交的.看起来 git 没有看到我的工作目录并在其他地方寻找.
I started getting this message. No matter what I edit and try to commit, it says there is nothing to commit. Looks like git does not see my working directory and looking somewhere else.
如果我运行 git status
它输出相同的:
If I run git status
it outputs the same:
nothing to commit (working directory clean)
如果我创建新分支并编辑某些内容,则会发生同样的事情.当我需要修复合并冲突时,这开始发生.当我想将我的一个分支与 master 分支合并时,我必须手动修复它,并且我需要我的文件看起来与该分支中的文件完全一样,覆盖 master 分支那些相同的文件.所以我添加了这些文件,它让我合并它.但是无论我更改什么,它都显示为没有什么可提交的.
If I create new branch and edit something, then same thing happens. This started happening when I needed to fix merge clashes. When I wanted to merge my one branch with master branch, I had to manually fix it and I needed my files to look exactly as in that branch overwriting master branch those same files. So I added those files and it let me merge it. But then no matter what I change it shows as there is nothing to commit.
这里可以做什么?
推荐答案
发现问题所在.我不明白是怎么回事,但是 .git
目录路径不知何故被更改为其他路径而不是我工作的路径.所以我更改的任何内容都没有被检查,因为 git 正在其他地方检查.我注意到了,当我重新初始化它时,它显示它重新初始化了完全不同的目录.当我从当前目录 cd ..
和 cd
返回到它然后再次重新初始化时,然后它切换回正确的 .git
目录并开始查看我的更改.
Found what was wrong. I don't understand how, but .git
directory path somehow was changed to other path than I was working in. So then anything I changed was not checked, because git was checking in other place. I noticed it, when I reinitialized it and it showed that it reinitialized entirely different directory. When I cd ..
from my current directory and cd
to it back again and then reinitialized yet again, then it switched back to correct .git
directory and started seeing my changes.
这篇关于对错放的 .git 目录进行故障排除(无需提交)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!