Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Those are refs. Not commits. GitHub removes access to the old commits of a branch when the branch is force-pushed (say, after a rebase). I'm interested in comparing the branch in its current state against it's previous state.


tl;dr you can put commit hashes in the place where the parent comment put tags, and your exact use case actually has a dedicated link on the PR page.

The PR interface actually exposes this for force-pushes, but the UI discovery for this is horrible. It turns out that the "force-pushed" part in the little message in the github UI is actually a link. This link points to the diff between the old and the new HEAD of the branch.

As an example you can look at this PR:

https://github.com/JelteF/derive_more/pull/161

It has this little message somewhere down the page:

Monadic-Cat force-pushed the add-unwrap branch from e130dbe to 25235aa 4 months ago

If you then click "force-pushed" in that message you go to the "compare" page, which shows the diff between the two commits:

https://github.com/JelteF/derive_more/compare/e130dbe6b2a429...

Disclaimer: I'm a Micrsoft employee, but don't work on Github. I'm a daily user of Github though.


I have been told this multiple times, and I've tried this too. Maybe it works for public repos, but it doesn't work for private repos.


Pressing the "force-pushed" link works fine for me on private repos too. It could be that they fixed this recently, I only found out about this feature ~a month ago. If it still does not work on private repos for you, maybe try reaching out for support. It could be that there's some bug you're hitting.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: