3

I have 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?

Cascabel
  • 479,068
  • 72
  • 370
  • 318
doublejosh
  • 5,548
  • 4
  • 39
  • 45
  • Can you specify where you see the differences? Do the top commits have different SHA1? It looks like you are not sure if all files where committed. Can you give the result of `git status` both in the original repository and in the clone? – Gauthier May 27 '10 at 09:09
  • status shows them both as clean repos, that what I was saying. – doublejosh May 27 '10 at 09:13
  • ok, are you sure that the files that differ are in the repositories? When I asked about `git status`, I was referring to the `Untracked files` part of the result. Since you have the same hashes, the differences you have do not seem to be committed to the repo. – Gauthier May 27 '10 at 11:30
  • I know crazy right? No untracked files, clean repos both. I can even look in the log for each repo and see where the additions happened. But in one repo the file is not reflective of those changes. My brain is scrambled. – doublejosh May 27 '10 at 18:54
  • The output of `git show-ref; git rev-parse HEAD; git status -s` in each repository might be illuminating. – Chris Johnsen May 29 '10 at 06:33
  • 1
    Just so you don't think you are totally crazy, I came here with exactly the same symptoms you had, and will likely resolve it the same way you did -- wipe it out and reclone. – Watusimoto Nov 14 '12 at 11:48

4 Answers4

2

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.

0

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)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • the files in question are not in my .gitignore however on a related note now I'm wondering how to update my index with regard to what should be ignored. – doublejosh May 27 '10 at 09:14
  • @doublejosh: "on a related note now I'm wondering how to update my index with regard to what should be ignored": see http://stackoverflow.com/questions/2897753/git-status-shows-a-file-that-i-have-listed-explicitly-in-my-gitignore-file/2897782#2897782 – VonC May 27 '10 at 10:13
  • Thanks for the link! On this issue, no branches (as I understand them, explicitly created branches.) – doublejosh May 27 '10 at 18:06
  • Yeah, double checked (since I haven't done branching yet) there is only a master in each. – doublejosh May 27 '10 at 18:55
0

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.

doublejosh
  • 5,548
  • 4
  • 39
  • 45
0

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