It looks like commit 50b6dec
was added to the gh-pages
branch, and commit e43c01f
was made on master
at the same time, and this is what caused the merge conflict.
Because of that, gh-pages
had 1 commit that master
did not have. So any time you merged after that, Git was not able to do a fast-forward merge. (The fast-forward merges is what gave you the linear history you had before.) Thus, the solution is:
git checkout master
git merge gh-pages
To prevent this from happening again in the future, change your process to this:
git checkout master
git commit -am "message"
git checkout gh-pages
git merge --ff-only master
The --ff-only
flag will abort the merge with an error if gh-pages
has any commits that master
doesn't have.
If you want to rewrite history so that it is as if this never happened, you can do that too.
First, ensure you are on master
:
git checkout master
Now rebase:
git rebase 50b6dec
You'll have to resolve that conflict again. When finished, do:
git rebase --continue
When the rebase is complete, you will have to force-update origin
:
git push --force-with-lease origin master
You'll also have to move the gh-pages
branch. Do:
git branch -f gh-pages master
git push --force-with-lease origin gh-pages
This will give you a history that looks something like this:
* f218f70' (HEAD -> master) Added Scatterplot functionality to check ratings
* cb79b79' Squashed bug
* fcf0d8a' Small change
* e43c01f' Small change
* 50b6dec Small change
* a217267 Small change
Obligatory warning: Since a rebase rewrites history, this can be dangerous / disruptive for anyone else working on this branch. Be sure you clearly communicate what you have done with anyone you are collaborating with.