master -> main 강제 병합?

charl hi·2022년 1월 10일
2

깃과 깃허브

목록 보기
6/6

master -> main 덮어쓰기

"There isn't anything to compare. Nothing to compare, branches are entirely different commit histories"

  • 위와 같은 문제 해결
git checkout master
git branch main master -f
git checkout main
git push origin main -f

출처: master -> main



📢📢문제

  • 알고보니 master에 있는 걸 main에 다갖다 덮어쓰기
    -> main에 작업한 게 싹다 사라지므로 주의!!!



디폴트로 브랜치 설정

git config --global init.defaultBranch main

출처




브랜치 삭제

원격저장소의 브랜치 삭제

  1. 깃헙에서 저장소의 default 브랜치가 main인걸 확인

  2. 브랜치 삭제

git push origin --delete master

📢📢주의

github에서 사라질뿐, git에선 그대로다.
저건 원격저장소인 github의 저장소 삭제방법이기 때문



로컬저장소의 브랜치 삭제

git branch [-d] 브랜치명
  • -d : 병합여부와 관계없이 삭제

1개의 댓글

comment-user-thumbnail
2022년 10월 8일

감사합니다.

깃 처음이라 삽질하고 있었는데, 한방에 해결되었습니다!!

답글 달기