Interview Prep/Git & GitHub/Merge, rebase and cherry-pick

What is a patch ID and how does Git use it to skip duplicates during rebase?

AdvancedConceptMerge, rebase and cherry-pick
Answer

<details> <summary><b>Answer</b></summary>

git patch-id hashes the diff content ignoring line numbers and whitespace. Rebase and git cherry compare patch IDs so a commit already applied upstream (for example cherry-picked) is dropped from the replay instead of conflicting. This does not work for squash merges, which change the combined patch.

All Git & GitHub questions Roadmap: Git & GitHub

More on Merge, rebase and cherry-pick