Study/Git
[Git Error] There isn't anything to compare. [main] and [master] are entirely different commit histories. 오류 해결
momong'-'
2023. 4. 24. 14:51
기존에는 default branch명이 master로 되어있었다가 최근에 인종차별적으로 인식될 수 있어 main으로 변경되었다고 한다.
main으로 되어있는데 teminal에서 제어할 경우 master로 되어있는 경우
commit하고 Pull Request에 들어가면 There isn't anything to compare. 메세지를 볼 수 있다.
git checkout master
git branch main master -f
git checkout main
git push origin main -f
다른 branch이름으로 push하고 싶을 경우 main자리에 원하는 +branch이름을 넣어서 실행하면 된다.
git push origin +[branch명]
로그인을 하고 난 뒤 main으로 들어가면 제대로 commit and push된 것을 확인할 수 있다.