profile image

L o a d i n g . . .

기존에 codesandbox로 수업하던 main대신 master branch를 default로 지정했다.

 

 

 

PS D:\workspace\workspace_oneBiteReact> git checkout master
Already on 'master'
Your branch is up to date with 'OneBiteReact/master'.


PS D:\workspace\workspace_oneBiteReact> git merge main
merge: main - not something we can merge

git checkout (브랜치명) : default 브랜치

git merge (브랜치명) : 병합할 브랜치

그런데 분명 branch가 두 개인데 병합할 게 없다고 떴다. 

확인해보니 브랜치 들어가는 경로가 잘못되어있어서 다시 작성했는데

 

 

 

그래도 자꾸 오류가 났다

PS D:\workspace\workspace_oneBiteReact> git merge origin/main
fatal: refusing to merge unrelated histories

 찾아봤더니 서로 관련 기록이 없는 두 프로젝트를 병합시킬 때 깃에서 기본적으로 거부하게되는데, 이를 허용해줘야한다고 했다.

 

git pull origin main --allow-unrelated-histories

--allow-unrelated-histories 를 사용하여 병합할 브랜치를 허용해주었다.

 

 

 

 

 

PS D:\workspace\workspace_oneBiteReact> git push origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 351 bytes | 351.00 KiB/s, done.
Total 2 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/Ina-dang/OneBiteReact.git
   402b978..c9226d2  master -> master
PS D:\workspace\workspace_oneBiteReact>

합칠 내용 없이 push 해줬더니 알아서 잘 들어갔다

 

 

 

참고 : 

- https://gdtbgl93.tistory.com/63

반응형
복사했습니다!