When and why do you need to do
All changes made by commits in the current branch but that are not in
<upstream> are saved to a temporary area.
The current branch is reset to
<upstream>, This has the exact same effect as
git reset --hard <upstream>.
ORIG_HEAD is set to point at the tip of the branch before the reset.
The commits that were previously saved into the temporary area are then reapplied to the current branch, one by one, in order.
Note that any commits in
HEAD which introduce the same textual changes as a commit in
HEAD..<upstream> are omitted (i.e., a patch already accepted upstream with a different commit message or timestamp will be skipped).