According to the Github for Mac blog announcement,
Once you’re ready to share your commits, or pull in remote commits — just press the Sync Branch button. We’ll perform a smarter version of
pull --rebase && pushthat reduces merge commits but doesn’t rewrite your merges.
What is “a smarter version” of pull --rebase && push? What exactly are they doing? Is it possible to do this “smarter” thing on the command line?
The blog post “Rebasing Merge Commits in Git” (from Glen Maddern) illustrates the danger of a
git pull --rebasewhen you have made local merges:If you do a
git pull --rebaseofmasteron top oforigin/masternow, you would delete your local merge.See the next picture after the rebase: no more merge commit.
That is what Github for (Mac|Windows) would detect and avoid.
If you didn’t detect it in time, the same blog post mentions the following recover:
Actual Solution:
You can achieve the desired result:
I suppose the “smarter version” of
pull --rebaseis that combination of “fetch + rebase preserving the merge”.Glen also proposes the following aliases to counter the fact that this sequence of command would no longer use the tracking information associated to a local branch.
Jason Weathered posted a “http://jasoncodes.com/posts/gup-git-rebase“, but now refers to git-up, from Aanand Prasad.