2

Lately I realized that I had lost some files in one of my projects hosted on Github, jquery.transition.js. I searched in the commit history to try to find when and how that happened but couldn't find any related commits.

Then I looked at its network graph on Github and found all of the commits and files in someone else's fork: https://github.com/ammonkc/jquery.transition.js/tree/gh-pages

I'm wondering how this is possible. Could it be that I inadvertently deleted the gh-pages branch and overwrote it? Shouldn't that appear in the commit history?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Louis-Rémi
  • 1,768
  • 1
  • 13
  • 14

1 Answers1

1

What usually can happen is:

  • a branch deleted or a forced push where those commit are no longer referenced
  • a fork done prior to that event which still referenced said commits

Such a push (with a rewritten history without those commits) can only happen if it is "forced" (push --force), but wouldn't leave a trace in the visible history (since the commits have been rewritten).
Even in the worst case scenario, the lost commits are still referenced in the reflog, which you can:

  • ask for at the GitHub support (they can create a branch referencing said lost commits).
  • or (as repo owner) query the GitHub events API:
    See "Does GitHub remember commit IDs?"
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250