본문 바로가기
Trouble Shooting

[Git] GitHub Pull Request가 안 되는 원인과 해결 (feat. There isn't anything to compare)

by 파이현 2025. 3. 6.

 

문제 상황

git push까지 마치고 create pull request를 하기 위해 github를 확인했는데 there isn't anything to compare이라고 화면에 뜨며 pr을 올릴 수 없는 경우

 

 

문제 원인

  • base branch와 commit history가 다르기 때문에 발생!
  • git clone을 통한 remote 연결이 아닌 git remote add를 통해 연결한 경우에서 git pull을 받아오지 않았을 때 발생
    • git remote -v를 통해 원격 저장소를 확인하면 코드를 올리고자하는 레포에 연결이 되어 있긴 함

 

문제 해결

rebase를 사용하자!
  • git rebase: base를 다시 설정한다는 의미로 rebase를 사용하면 base가 재설정되어 commit history가 합쳐지게 됨 
    • `git rebase <branch name>`
  • `rebase` 명령을 입력한 후 base branch와 merge 한 내용을 `commit`한 후 push 하면 pr을 올릴 수 있게 됨
    • 순서: git rebase <base branch name> -> git commit -m "message" -> git push origin <branch name> -> create pr