Skip to content
This repository was archived by the owner on Nov 18, 2021. It is now read-only.
This repository was archived by the owner on Nov 18, 2021. It is now read-only.

amending PR branches via force-push causes unreachable commits to vanish from web UI #998

Open

Description

@aspiers

When you want to amend a pull request, you have a choice of two ways to do it:

  1. Push new commits on top of the head of the existing PR branch
  2. 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.

Activity

  1. aspiers commented on Nov 22, 2018

    @aspiers
    CollaboratorAuthor

    Thanks to @KaelWD for noting that force pushes are now shown in the PR history:

    image

    This was also announced in GitHub's Changelog, albeit with very few details given.

    So I think this is now resolved! It also moves #999 closer to a resolution, which is great news.

  2. aspiers commented on Apr 11, 2019

    @aspiers
    CollaboratorAuthor

    Just realised this is not actually fully resolved, because GitHub decided to hide force pushes which are followed by other force-pushes 🤦‍♂️

    image

    I can understand the desire to avoid cluttering the UI with lots of force-pushes, but if GitHub wanted to hide old branch tips they should have provided an option to expose them again. Unfortunately the current approach makes it very hard to retrieve these old branch tips (I guess the API is the only way) or maybe even impossible if #997 bites.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions