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.
More on Merge, rebase and cherry-pick
What is the difference between a fast-forward merge and a merge commit?BeginnerHow does a three-way merge work?IntermediateWhat does `git rebase` actually do?IntermediateMerge versus rebase: how do you decide?IntermediateWhat are squash merge, merge commit and rebase-and-merge on GitHub?IntermediateWhy does a squash-merged branch show as unmerged to `git branch --merged`?Intermediate