Hacker News new | ask | show | jobs
by mvermaat 4371 days ago
In a way that's already true, since the commits are still there (and included when you clone). They're just not discoverable.

It would be neat though if GitHub added some UI magic to recover dangling commits, possibly using the knowledge of which branches previously pointed to them and/or push -f operations.

2 comments

You only get the commits reachable from the refs you clone. i.e. anything under refs/heads/* by default. Unless a commit is reachable from a ref you can fetch, it is not retrievable to you and won't be in your clone. So unless GitHub can locate it via reflog and create a ref, you won't be able to access it.
Aren't these part of what gets cleaned up by git gc?
Yes they are. But only after they get dropped from the reflog, after 30 days by default.
That is true, but only when they're older than 2 weeks (or whatever you define with --prune). I don't know what GitHub's configuration is here.