Any idea how GitHub perform sync of PR branch with target branch?

When I traditionally rebase local branch against master I always get plenty of conflicts, contrary to GitHub branch sync with master gives only a few. I try to adapt my local gitconfig to the way Github do it while we want to sync PR branch with target branch.

Any idea how this is performed from merge/rebase and gitconfig perspective? Any idea how GitHub perform "update branch" button action?

In my experience, much changes in versions of git itself. Slight changes to the flow and more importantly to the algorithms used behind the scenes happen every so often.

Additionally, they likely have custom proprietary algorithms for a lot of different languages they use in combination with git, at least some of the popular ones. Take a look at github/linguist, their gem to identify which language is being used in a given code sample. It uses Bayesian probability equations to figure out that a given codebase is, let's say, Ruby. Determining that's not so tough, but it gets you closer to language-intelligent diffing (as opposed to just looking at line-by-line cross-sections).

Now as you can imagine, looking at diffs of, for example, JSX, can get extremely painful. But if you are better able to tokenise the language structures in addition to straight up diffing, you can make a lot of intelligent guesses.

Personally, I definitely see a difference between their diffing and Gitlab's.

0 Likes
Adam Faryna Author

@fiiv interesting. Thanks for sharing.

0 Likes

Please sign in to leave a comment.