Skip to content

Instantly share code, notes, and snippets.

@sdg7onado
Created March 26, 2022 04:55
Show Gist options
  • Save sdg7onado/bc0e49a0d41a97e798c2df7c220de8bb to your computer and use it in GitHub Desktop.
Save sdg7onado/bc0e49a0d41a97e798c2df7c220de8bb to your computer and use it in GitHub Desktop.
How to Fix the Error: There isn’t anything to compare: main and development are entirely different commit histories.

How to Fix the Error: There isn’t anything to compare. main and development are entirely different commit histories.

Definitions

  1. 'main' out of date

  2. 'development' up to date

  3. 'issue' Unable to create PR from 'development' onto 'main' due to the following error: There isn’t anything to compare. main and development are entirely different commit histories.

Assumptions

  1. Fair understanding of Git

  2. Access to a computer and the internet 😉

  3. GitHub repository with main and development branches

Solution

  1. 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,

  2. 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.

  3. 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 on development ready for updating main

  4. Run git push you may need to add the --force option.

  5. 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.

  6. Proceed to create your PR and now you should have matching git history for main and development.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment