3 ms·
You don’t even need the pushes API to see commits that were force pushed away. You can get the head of any branch at a given time using `gitrevisions` [1] synta
by semiquaver 3y ago
You don’t even need the pushes API to see commits that were force pushed away. You can get the head of any branch at a given time using `gitrevisions` [1] syntax any place that you would normally put a branch or commit.
e.g to see the state of the cpython main branch on January 1 we can ask for `main@{2024-01-01}`:
https://github.com/python/cpython/tree/main@{2024-01-01} https://github.com/python/cpython/tree/main@{2024-01-01}
This does not walk the commit history, but instead the server-side reflog, so it’s immune to force pushing and can only be avoided by GC of the reflog or repo. Definitely contact GH support if you pushed something you shouldn’t have.
[1] https://git-scm.com/docs/gitrevisions https://git-scm.com/docs/gitrevisions
- g-b-r 3y agoEhm no, reflogs are notoriously local... To be 100% sure that something hasn't changed recently I tried and, nope, your revision command only looks at the local reflog, after a forced push you get different answers from the original repository (that has the full reflog) and a new clone.
- ylyn 3y agoI'm very confused by your comment. The grandparent comment talks about using the gitrevisions syntax in a GitHub URL to search the reflog stored on GitHub. Nothing to do with your local clone of a repository.
- semiquaver 3y agoYes, I refer to the reflog on GitHub’s git file servers which tracks the historical state of refs there.
- g-b-r 3y agoI'm sorry, I was on mobile and for some strange reason didn't check the whole link. I guess I was tired. Incredible, I didn't know about it.