Home > Back-end >  How to fix a discrepancy between my local git repo, and the one on GitHub?
How to fix a discrepancy between my local git repo, and the one on GitHub?

Time:10-03

I have a strange discrepancy between my local git and the one on GitHub. Both repos are at the same level but the local one has modifications (a few commits in the past) that the GitHub one did not register at the file level (the commit is there).

I noticed that for some reason .git was in my .gitignore file, I removed it, commited, and pushed but nothing changed (removing .git form .gitignore did not trigger any new files to be committed).

As an example, I have a file CurrentTime.vue locally, but it is currentTime.vue on GitHub. That was indeed the old name of the file, changed a few commits ago (and this commit is present on GitHub as well).

I have a single, linear branch (master).

My questions:

  • is it possible that for identical repos, with the same history, there would be a difference between them?
  • if so - is it possible to force a push of the complete repository so that they become identical (I guess this is equivalent to deleting/recreating the GitHub repo)?

CodePudding user response:

Ripley: ... nuke the entire site from orbit. It’s the only way to be sure.

If your local repo is the source of truth then rename->recreate may be the solution.

However, you can:

  • git mv currentTime.vue CurrentTime.vue and see if the change is now correctly processed.
  • Install "Windows Subsystem for Linux" (it's easy) and look at your repo there. Linux is a case-sensitive operating system and will highlight all case changes.

CodePudding user response:

This ended up being a setting in the local repo .git/config, I had ignorecase = true in [core].

After carefully reviewing the commit, I realized that there were changes to (for instance) currentTime.vue (lower case) and I took them for also being a rename.

This search was triggered by @tytam's comment about looking again at the commit. Thank you.

  • Related