amending PR branches via force-push causes unreachable commits to vanish from web UI #998
Description
When you want to amend a pull request, you have a choice of two ways to do it:
- Push new commits on top of the head of the existing PR branch
- Force-push (
git push -f
) a new head to the PR branch, thereby rewriting history.
Unfortunately currently both have significant problems, as explained in this issue's sibling #997.
This issue is for tracking just one of the problems with the second (force-push) approach: amending PR branches via force-push causes unreachable commits to vanish from the web UI. (#997 and #999 document other, separate problems with this approach.)
This is in stark contrast to Gerrit which preserves every version of a patch set for every review.
For a concrete example, see aspiers/test#3. At some point I force-pushed a commit with SHA1 bdb 4c22
(space inserted to avoid accidental pinning which would break the garbage-collection experiment in #997). Now that SHA1 is no longer linked from aspiers/test#3 (other than from my manually constructed and deliberately obfuscated hyperlink).
There is a workaround but it is far from convenient: assuming the commits you are interested in have not been garbage-collected as a result of #997, you can use GitHub's API to walk the PR branch's "reflog" equivalent and recover commits from that.