Reputation: 902
I'm trying to checkout a specific commit that I see on GitHub:
https://github.com/mapbox/node-sqlite3/commit/b8907e79fc3fb52803b5a05c106948911dcd77ac
However, a local checkout fails:
$ git checkout b8907e79fc3fb52803b5a05c106948911dcd77ac
fatal: reference is not a tree: b8907e79fc3fb52803b5a05c106948911dcd77ac
A git reset
failed with the same error.
Any ideas?
Upvotes: 1
Views: 1733
Reputation: 1325137
Depending on how frequently GitHub runs a git gc
in each of its repository, that commit, if it was deleted, might still be on GitHub side.
A trick would then be to use the GitHub Tags API to create a tag object for that old commit.
You could the do a git fetch --tags
, and that would be enough to enable a local checkout of that commit.
Upvotes: 2
Reputation: 488519
That commit was in that repository at one time.
It was subsequently deleted from the repository, so new clones of that repository do not get that particular commit. (Deletion is a bit tricky, but for example, this can happen because a pull request gets modified—the commit was there because of the pull request, then the pull request itself gets updated with new-and-improved commits. The replacement commit is the one ultimately used, and the original expires on its own after a few more days.)
It still is present on GitHub because GitHub does not always clean out everything immediately. In this case, however, they have not cleaned things out for quite a long time, and it's not clear why it's still accessible via the GitHub web interface at all. This commit is not reachable from a pull request either (there are 218 pull requests hanging on to commits but this is not among them). I wonder if links from "issues" pages might also keep otherwise-unreachable commits alive, on GitHub.
Following this commit backwards, through its parent links on GitHub, reveals a whole sequence of commits that seem to have been replaced with new-and-improved versions at some point.
Upvotes: 2