본문 바로가기
Git & GitHub

[Git] master branch 이름 변경으로 인한 오류

by 개발짜 2022. 9. 9.

git repository 새로 생성 해서 첫 push 를 하는 도중 발생한 오류이다

야호 push는 너무 잘 됐다

 

이제 github에서 Compare & pull request 하려고 보니 

"There isn't anything to compare. Nothing to compare, branches a

re entirely different commit histories"

 

...왜 없어?

 

알고보니까 GitHub에서 default 브랜치를 'master' 브랜치로 사용하다가, 'main' 브랜치로 이름을 변경 했다.

 

원래라면 'master' 브랜치에서 'develop' 브랜치 땄어야되는 건데,

 

아무것도 없는 상태에서 처음 'develop' 브랜치를 생성하고 그 브랜치에 push 하는 과정에서

 

아예 다른 히스토리로 잡혔기 때문에 저 에러가 나오는 것이다.

 

만약 -f 옵션으로 브랜치를 강제로 해도 된다면,

git checkout master   
git branch main master -f    
git checkout main  
git push origin main -f 

이렇게 하면 된다.

 

출처: https://stackoverflow.com/questions/23344320/there-isnt-anything-to-compare-nothing-to-compare-branches-are-entirely-diffe

댓글