https://velog.io/@chaeb1n/Remotes-git-status-%ED%98%84%EC%9E%AC%EC%83%81%ED%83%9C
fetch
무작정 commit하지 말고 원격저장소의 변경된 내용을 pull해준다. (fetch를 쓰면 변경히스토리를 모두 가져올수있다.)
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-upstream origin main:main
Pushing to https://github.com/yoondgu/city-mapping.git
To https://github.com/yoondgu/city-mapping.git
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/yoondgu/city-mapping.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Completed with errors, see above.
pull하면
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch --no-tags origin
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks pull origin main
From https://github.com/yoondgu/city-mapping
* branch main -> FETCH_HEAD
fatal: refusing to merge unrelated histories
Completed with errors, see above.
라고 뜬다
==> https://gdtbgl93.tistory.com/63
이럴 때는 위 링크 설명처럼, cli에서
git pull origin 브런치명 --allow-unrelated-histories
실행해주면 된다. unrelated-histories를 허용해준다는 의미.
서로 관련된 기록이 없는 프로젝트들을 병합할 수 있게 해준다.
보통은 잘 쓸 일이 없는 명령이다.