Question

I am working on a project which requires me to checkout older commits of git projects. At times, I get a peculiar error in that despite retrieving a commit hash from git, I am unable to locate it in the log or to pull it.

For example: https://github.com/code4craft/jsoup/commit/4a28f7766124469dbdd5ad6179fe84abff3cd14f

When I pull the main jsoup repository from https://github.com/jhy/jsoup.git

And I try:

git checkout 4a28f7766124469dbdd5ad6179fe84abff3cd14f

I get:

git checkout 4a28f7766124469dbdd5ad6179fe84abff3cd14f
fatal: reference is not a tree: 4a28f7766124469dbdd5ad6179fe84abff3cd14f

Any advice?

Was it helpful?

Solution

That's because there's no reference pointing to it. In order to be fetched either a branch or a tag must be a descendant of the commit.

So most likely you wouldn't be able to fetch it again.

Commit exists on GitHub but not in my local clone

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top