'Github approvals to survive rebase -i?

I'd like to support the following scenario:

  • Pull request is marked as approved
  • Author force-pushes the exact same code with a different git history (rebase or rebase -i squash)
  • Author merges code

Normally, a force-push will clear any approvals, since it could be of completely different code. And I wouldn't want to keep approvals around in that scenario. But is there any way to get github to check?



Solution 1:[1]

There's no way to do this because in general, it's not easy to determine whether two sets of commits introduce the same changes.

The logical way you'd try to do this is with diff output, but because the rebase can introduce context changes, code movement, or renamed files, this isn't really possible. Looking at only the added and removed lines without context wouldn't be effective because adding the same code to a different function would be a substantively different change. Whether a set of rebased changes is "the same" requires substantively more knowledge about the code than Git has or can provide.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bk2204