1

In one of my repositories on GitHub, some commits are missing. I am pretty sure about it:

contributions

and clicking on the link "11 commits" yields a page with the message "No commits found for <user>". A possible cause is a --force commit that overwrote other commits.

Therefore I'd like to rummage around in the project's history including the dead branches, for example using git reflog. I can't do it by cloning or forking the project, because reflog acts on the local repository and therefore does not see the dead branches.

So: is there a way to run Git commands (here, reflog) directly on GitHub?

Alternatively, does anyone know of a way to clone the GitHub repository together with its dead branches?

Ivan dal Bosco
  • 3,233
  • 4
  • 19
  • 24
  • 1
    Did you try `git clone --mirror`? – jessehouwing Jan 11 '22 at 13:35
  • @jessehouwing. Thanks a lot for the advice. Unfortunately, a `git clone --mirror` followed by `git reflog show --all` returns an empty output. The GitHub version of the repo is really clean... – Ivan dal Bosco Jan 11 '22 at 14:52
  • 1
    Cloning does not copy reflogs: you can't get vanished commits that way. GitHub do generally keep all commits forever by default (for various reasons) *and* in modern Git you can ask for any commit by its hash ID, but you must know the hash ID. If you do, use `git fetch origin :refs/heads/recovered-branch` for instance. – torek Jan 12 '22 at 01:40
  • They don's happen to be committed to a fork? https://github.com/ivandalbosco/enu-mediation – jessehouwing Jan 12 '22 at 03:20
  • @jessehouwing Thanks for your efforts. Unfortunately the fork you mention is not relevant: the lost commits were created by a non-technical colleague (without any `git clone` command or fork action) directly on the GitHub GUI. My screenshot above prooves he really created commits. – Ivan dal Bosco Jan 12 '22 at 07:44
  • @torek. Many thanks. Unfortunately, as the commits were created directly on the GitHub GUI, their SHA-1s have never been stored locally. – Ivan dal Bosco Jan 12 '22 at 08:01
  • Contact GitHub support I suppose. – jessehouwing Jan 12 '22 at 09:14

0 Answers0