Compare old and new versions of force-pushed GitHub pull request

the old version of the PR

You can do so directly on GitHub: see “Find committer of a force push on GitHub”

Clicking the “force-pushed” link will show a two dot comparison between the two commits.


Original answer: 2016

That would be only available in the reflog of the remote repo, which would include the previous HEAD of the branch force-pushed.
Since the remote repo is a GitHub one, you still can infer the old commit by looking at push events: see “Does github remember commit IDs?”.

hat will also show changes that have been introduced into the base branch (typically master)

More exactly, you will always have the differences against a common ancestor (which will include commits from the base branch like master)

See What are the differences between double-dot “..” and triple-dot “...” in Git diff commit ranges?

http://mythic-beasts.com/~mark/git-diff-help.png

So in your case, your forced-pushed branch looks like this on the remote repo:

      x--x--x        (old branch in reflog)
     /
 m--M0--M--M   (master)
            \
             X--X--X (new branch forced push)

A diff old_HEAD..newHEAD would include the few M commits from the base branch, as they are part of the common ancestor (M0) path.

So you can compare a force-pushed branch (providing you are monitoring pushEvents and know of the previous HEAD of that branch).
But uou cannot easily compare two branches without their common ancestor path.

Leave a Comment