I have forked a repo from GitHub and made some commit on my master branch. And the upstream repo's master branch have some commits ahead of mine. So I need sync these commits.
$ git remote -v
origin git@github.com:johnwatsondev/react-navigation.git (fetch)
origin git@github.com:johnwatsondev/react-navigation.git (push)
upstream https://github.com/react-community/react-navigation.git (fetch)
upstream https://github.com/react-community/react-navigation.git (push)
$ git pull --rebase upstream master
From https://github.com/react-community/react-navigation
* branch master -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: Update: add logic for invoking back key pressed listener in CardStack.js and remove default process logic
Applying: Update: only android platform need process physical back key pressed event
$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 6 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean
$ git pull
Merge made by the 'recursive' strategy.
$ git status
On branch master
Your branch is ahead of 'origin/master' by 7 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
I got this ugly commit history in my origin repo's master branch below:
How can I make a elegant OP to sync my origin repo's master branch to upstream's master branch without ugly duplicate commits and the Merge branch ***
commit?
(PS: I have make some change in my origin repo's master branch)