5

I have an orphaned commit produced by another person, and I see it in GitHub GUI. This commit is not accessible by cloning the repository as there are no branches/tags that contain this commit on the path. Assuming that the author of the commit has removed his local repository, I wish to assign a branch/tag to this commit directly in GitHub.

This commit can be seen just using a direct link that I can use because it's git hash is known. The commit is not seen in the Insights>Network however.

How can I assign a tag to the commit from this commit page in GitHub? Is that possible to create a new branch directly from this page? What are other ways to return this commit back in service?

John Kugelman
  • 349,597
  • 67
  • 533
  • 578
Dmitry Kuzminov
  • 6,180
  • 6
  • 18
  • 40
  • Are you able to assign that commit object to a "release" to bring it back in service? As in https://stackoverflow.com/questions/18216991/create-a-tag-in-a-github-repository - Then it also becomes a tag. – zrrbite Oct 16 '20 at 22:55
  • That doesn't work as the *Target:* doesn't have this commit in the list of *Recent Commits*. The orphaned commit is one year old. – Dmitry Kuzminov Oct 16 '20 at 23:04
  • 1
    I think i found something. Go to `https://github.com///tree/`. Select the dropdown for that hash in the upper left corner of the file list and create a new branch based on that commit. https://pasteboard.co/JvYJdgo.png – zrrbite Oct 16 '20 at 23:28
  • Based on your recommendation I've found a way to create a Pull Request from this commit to any other branch. That should work to solve my issue. I'm not sure how did you create the branch (did you do that without a PR?), but if you answer with the explanation, I'd accept your answer. – Dmitry Kuzminov Oct 16 '20 at 23:37
  • I'll clarify in an answer. – zrrbite Oct 16 '20 at 23:38

1 Answers1

4

Making an orphan commit cloneable again

Orphan commits that reside only on the remote (as long as garbage collection allows) cannot be cloned.

Through the Github web interface, using a direct link (e.g. https://github.com/<user>/<repository>/tree/<orphan-commit>) to the tree object connected to an orphan commit, you can access the Create Branch interface to create a new branch based on <orphan-commit> (which you already know the hash of) and make the object cloneable again.

enter image description here

zrrbite
  • 1,180
  • 10
  • 22