Backend/Github

[Git][error] git pull 안될 때 해결 방법

moonsunah 2024. 3. 18. 13:44
반응형

 

Git config 전략에 대해서 알아보자

 

노트북하는 망초

 

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 hint: invocation.

 

git pull을 당기다가 이런 오류를 마주칩니다

 

 

현재 상태

 

로컬에서 작업하던 중

원격에서 commit , merge가 있었고 그걸 미리 pull 하지 않고 

로컬을 원격에 push 후에 git pull을 하니 이런 충돌이 났습니다

 

 

이런 환경에서는 git pull 이 되지않기 때문에 git config 전략을 사용하여 해결합니다.

 

 

 

해결 방법

 

1.

git config pull.rebase false

 

 

 

 

 

2.

git config pull.rebase true

 

 

 

 

 

3.

git config pull.ff only

 

 

 

 

 

 

 

3가지 방법 중 자신에게 맞는 방법을 선택한뒤 

git add .

git rebase --continue

 

위 순서대로 명령어를 입력해준다.

 

rebase가 끝나고 나면 commit 을 한 뒤 올려주었다.

 

 

 

 

 

 

참고

반응형

'Backend > Github' 카테고리의 다른 글

[Github] Pull Request 수정 후 다시 올리기  (0) 2024.03.12