How to Fix the Error: There isn’t anything to compare. main and development are entirely different commit histories.
-
In your terminal/command prompt, etc. enter the following command:
git checkout development
If you are already on development, you may get the message Already on 'development' Your branch and 'origin/development' have diverged, -
Run
git reset --soft master
. This resets the main and development to the same place in the git history. Note that the changes are now staged. Uncommitted changes are also reserved in the staging area. -
Run
git commit
. (I tend to include the -m 'message' here to avoid having to deal with Vim - ☹). At this point we have our most recent changes ondevelopment
ready for updatingmain
-
Run
git push
you may need to add the--force
option. -
On GitHub, visit the main branch. You will see the option to create a PR with the mention that development has recent commits or pushes.
-
Proceed to create your PR and now you should have matching git history for
main
anddevelopment
.