git pull을 하려는데
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.
으로 warning이 떴다.
git pull을 하려고 하면 pull 방식을 명식하라는 뜻인데, git pull은 git fetch와 merge를 합친 명령어다. 그 중 merge 방식을 명시하라는 에러다.
기존 pull의 경우, pull을 받으면 불필요한 merge commit이 생성된다. 마치 3-way merge와 같은 모양새다. (아래 그림에서의 빨간색 commit이 바로 불필요한 merge commit이다.)
<aside> 🤖 GPT4
feature
**라는 브랜치에서 작업을 완료하고 master
브랜치에 병합합니다. 이후 B가 feature
브랜치에서 작업을 계속하다가 A의 변경사항을 로컬에 반영하고자 할 때 **git pull
**을 사용합니다.git pull
**은 git fetch
(원격 저장소의 최신 내역을 로컬에 가져오는 과정)와 git merge
(가져온 변경사항을 현재 작업 중인 브랜치와 병합하는 과정)의 조합입니다. B가 **git pull
**을 실행하면, 원격 저장소의 master
브랜치 변경사항이 로컬 feature
브랜치에 병합됩니다.pull 하려는 원격저장소의 브랜치와 로컬저장소의 브랜치가 fast-forward 관계일 때만 pull을 허용한다.
두 브랜치가 fast-forward 관계라는 건 둘 중 하나를 의미한다.
두 브랜치가 갈라진 commit을 기준으로 로컬저장소에만 새로운 commit이 있고, 원격저장소에는 없다. 원격저장소에만 새로운 commit이 있고, 로컬저장소에는 없다.
첫번째 경우는 pull을 받아올 필요가 없으므로 두 번째의 경우에만 pull이 가능하다는 뜻이 된다.