1

I have this repository that i forked from another one, and now i need to make a pull request to it, but it says that: "There isn’t anything to compare.", and my commits are not showing: https://github.com/amorimll/desafio-sharenergy-2023-01 enter image description here

Any help is appreciated, really need this for today.

This is showing in the git rebase:

enter image description here

amorim
  • 67
  • 6
  • 1
    https://stackoverflow.com/questions/23344320/there-isnt-anything-to-compare-nothing-to-compare-branches-are-entirely-diffe – KaraX_X Jan 10 '23 at 22:08
  • 1
    this seems like the solution you need to me – KaraX_X Jan 10 '23 at 22:08
  • 1
    is your main branch have any commits ahead your current master branch? if so you need to do rebase or merge first then to create a PR – KaraX_X Jan 10 '23 at 22:16
  • 1
    So I saw the link you posted. it said `This branch is 16 commits ahead, 1 commit behind SHARENERGY-OFICIAL:main.` and you need to fixed this 1 commit behind by rebase as i mentioned above, then you should be good to go – KaraX_X Jan 10 '23 at 22:20
  • Ok, i'm doing it – amorim Jan 10 '23 at 22:22
  • 1
    what you typed for command? – KaraX_X Jan 10 '23 at 22:46
  • I didn't type, i just used the rebase command and this appeared – amorim Jan 10 '23 at 22:49
  • 1
    did you clean the current branch your working on? you need to save all the changes first. it said `please enter the commit message for your changes` – KaraX_X Jan 10 '23 at 22:54

1 Answers1

1

Short answer

will be checkout to your main branch get the lastest code, then go back to your current working on branch and do git rebase [currentBranchName] main

Explain

so when your create a branch from another branch, is like your created a snapshot code from that branch at that moment. ideally the branch you copied form should prevent make any more changes if possible, until you done working in the new branch and create the PR and done marge it. what rebase command will do is in case the origin branch had changes, it will pull the latest code form that branch into your working branch first, then to applied any changes you was made for your current working branch. Usually this process will need have some conflict need to fix, if they changed the same file.

Hope this is help you understand :)

KaraX_X
  • 326
  • 2
  • 11