-
[GIT] merge 이슈 해결GIT 2023. 4. 10. 09:58반응형SMALL
GIT
충돌 해결# git push가 되지 않을때
- pull방식을 명시적으로 정하지 않았기 때문에 발생
- 레포지토리에서 pull을 받을 때, pull 전략을 명시해주어야한다 (rebase, merge, fast-forward : ff)
[아래와 같은 에러 발생]
warning: Pulling without specifying how to reconcile divergent branches is discouraged. You can squelch this message by running one of the following commands sometime before your next pull: git config pull.rebase false # merge (the default strategy) git config pull.rebase true # rebase git config pull.ff only # fast-forward only You can replace "git config" with "git config --global" to set a default preference for all repositories. You can also pass --rebase, --no-rebase, or --ff-only on the command line to override the configured default per invocation.# git pull
git pull --help 를 보면 다음과 같은 내용이 있다. ... In its default mode, git pull is shorthand for git fetch followed by git merge FETCH_HEAD. git merge FETCH_HEAD 와 같이 동작한다는 것을 알 수 있다. 즉, 기본 mode같은 경우, git pull을 수행하게 되면 git merge commit을 생성하게 된다. 따라서, 기존에 존재하지 않는 commit이 자동으로 생기게 된다.# 힌트에 따라 명령어 작성
# git rebase같은 경우 history가 정리된다는 장점이 있지만, rebase같은 경우 잘 알지 못하고 사용하게 되면 별도의 알림 없이 영구적으로 history를 임의로 변경시키기 때문에 주의가 필요하다. # --ff-only기본옵션 git config --global pull.ff only # --rebase기본옵션 git config pull.rebase false --global 위와 같이 설정하게 되면 git pull의 default옵션으로 지정되어 실행된다. git pull git add . git commit -m ''반응형LIST'GIT' 카테고리의 다른 글
[Git] merge, push, pull (0) 2023.04.04 [Git] git stash 명령어란 (0) 2022.03.04