Few files out of sync but git doesn't seem to notice
I 开发者_StackOverflowhave two repos that claim to be clean. One was originally cloned from the other and is used for dev work.
There are a few files that I can see are not the same. However when I try pulling either way it says everything is up to date.
How is this possible?
Did that file miss a commit somehow? ...but shouldn't the difference be noticed regardless?
Do I need a refresh of some sort?
I seem to have had the same problem.
There was a difference in the working copy and the index which did not show up in git status
cat file # show file in working copy
git show :file # show file in index/staging
these outputs had clear differences while git status said it was a clean working copy.
After some searching i found that the index was probably corrupt and found https://makandracards.com/makandra/5899-how-to-fix-a-corrupt-git-index
rm .git/index
git reset
which fixed the problem for me. If any files were staged they are probably lost but at least now git sees the changes in the local working copy.
Maybe you have some commits in repo A branch b, while repo B has no modifications yet in branch b (but may have some modifications in other branches)
Meaning a git pull B
will return "Already up-to-date.
"
That or those files with differences are actually ignored (have been removed from the index and are selected by the .gitignore
file)
To answer my own question, I've decided to deal with this very odd situation by cloning the original repo and just archiving away the seemingly broken repo.
I assume the problem came from pulling bi-directionally. However it shouldn't have because the change was committed and pulled across.
Perhaps the gnomes were at work on this one. But I still have faith in GIT.
My problem was that I went with the default sources
git pull
>> Already up to date.
git push
>> Everything up-to-date
It worked when i used the direct branch and source:
git pull origin main
// *merged and did some changes*
git add .
git commit -m "message"
git push origin main
精彩评论