[ERROR] fatal: Need to specify how to reconcile divergent branches.

zirryo·2023년 1월 12일
0

❌ ERROR

목록 보기
4/6
post-thumbnail

Error

  1. terminal
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
  1. situation
  • remote repository > local repository 로 clone 받은 후,
    remote repository 와 local repository 에 서로 다른 변경사항이 발생함.
  • pull 하기 위해 터미널에서 다음과 같이 git pull 을 입력하였으나 아무일도 일어나지 않고 위와 같이 출력됨.




Solution

현재 상황에서는 두 브랜치를 하나로 merge 해야 한다.

위의 hint 를 보면 서로 다른 변경사항으로 인해 브랜치가 나뉘어져서, 두 브랜치를 합치기 위해 config 설정이 필요하다는 것을 알 수 있다.

git config pull.rebase false

위와 같이 입력하여 merge 하도록 설정한다.

git pull origin main --allow-unrelated-histories

그리고 위와 같이 입력하여 다시 pull 을 시도한다.
정상적으로 pull 이 수행되는 것을 확인할 수 있다.⠀⠀



git commit, git push 로 원격 레포지토리에 수정사항을 반영한다.

원격 레포지토리에서 변경된 기록을 확인할 수 있다.




🔗 reference

0개의 댓글