Recovering a rebased commit from GitHub
A stupid way to recover a commit that has been rebased and is now unreachable (ref):
- Given unreachable commit
- See if you can compare it to any earlier commit you have, e.g.
- Push your local commit up to a recovery branch:
git checkout f571415f4da9cc28edc83242e353966677dabcd2; git checkout -b recovery; git push origin recovery.
- See the patch commits:
https://github.com/org/repo/compare/recovery...332a2b9f43f1f8d7730e0a01356ea183dfadd470.patchand download as recovery.patch (you could curl unless it’s private so blah blah)
- Apply the patch commits and push up:
git am recovery.patch && git push origin recovery.
Tada! You have now recovered and shared that commit!
blog comments powered by Disqus