문제상황
local에서 작업했다. github repository에 있는 코드를 가져오고 그것과 내가 local에서 작업한거를 합친다음에 push하려고 했다. 사실 먼저 repository에 있는걸 가져온 다음에 local에서 작업했어야 하는데 깜빡했다.
warning: no common commits
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 659 bytes | 54.00 KiB/s, done.
From https://github.com/rpf5573/react-without-create-react-app
* branch main -> FETCH_HEAD
* [new branch] main -> origin/main
fatal: refusing to merge unrelated histories
해결방안 찾기
쉽게 찾았다. unrelated histories(내가 github repository를 만들면서 같이 생성했던 README.md파일)도 그냥 가져와버린다음에 다시 push를 했다.
git pull origin main --allow-unrelated-histories
..
...
git push origin main