본문 바로가기
부트캠프 개발일지 2023-2024/Git & Github

[2주차] Git / Github 이슈 기록

by whereanna00 2023. 10. 10.

Git / Github 이슈 기록

 

상황:

로컬에서 프로젝트파일을 수정중이었던 '나'.

그리고 그 당시에, 다른 팀원이 마지막으로 커밋, 푸쉬한 상태.

 

하고 싶은 것:

팀원이 마지막으로 올린 코드를 나의 로컬 프로젝트 파일에 pull 하기

 

방법:

내 로컬 프로젝트 파일에서 일단 save 저장

-> git add .

-> git git xommit -m "blablabla"

-> git pull origin 브랜치명

 

그러면 아래와 같이 나온다.

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.
fatal: Need to specify how to reconcile divergent branches.

 

문제해결방법:

git config pull.rebase false

git pull origin 브랜치명

 

그러면 이제 충돌표시가 뜨면서 코드가 pull 된다.

 

 

마무리작업 순서:

-> 충돌 해결

-> save 저장

-> git add .

-> git commit -m "blablabla"

-> git push origin 브랜치명

 

끝!

 

더보기

기록

 

ihamin@ihamin-ui-MacBookAir final % git pull origin release
remote: Enumerating objects: 65, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 47 (delta 33), reused 40 (delta 26), pack-reused 0
Unpacking objects: 100% (47/47), 298.42 KiB | 1.27 MiB/s, done.
From https://github.com/dancinncoder/B_team_five_website
 * branch            release    -> FETCH_HEAD
   e6865bf..7bc4b87  release    -> origin/release
Updating e6865bf..7bc4b87
error: Your local changes to the following files would be overwritten by merge:
        index.html
        style.css
Please commit your changes or stash them before you merge.
Aborting
ihamin@ihamin-ui-MacBookAir final % git add .
ihamin@ihamin-ui-MacBookAir final % git commit -m "팀원 페이지 수정"
[release e1dc8cf] 팀원 페이지 수정
 2 files changed, 76 insertions(+), 59 deletions(-)
ihamin@ihamin-ui-MacBookAir final % git pull origin release
From https://github.com/dancinncoder/B_team_five_website
 * branch            release    -> FETCH_HEAD
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.
fatal: Need to specify how to reconcile divergent branches.
ihamin@ihamin-ui-MacBookAir final % git status
On branch release
Your branch and 'origin/release' have diverged,
and have 1 and 13 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

nothing to commit, working tree clean
ihamin@ihamin-ui-MacBookAir final % git config pull.rebase false
ihamin@ihamin-ui-MacBookAir final % git pull origin release
From https://github.com/dancinncoder/B_team_five_website
 * branch            release    -> FETCH_HEAD
Auto-merging index.html
CONFLICT (content): Merge conflict in index.html
Auto-merging style.css
Automatic merge failed; fix conflicts and then commit the result.
ihamin@ihamin-ui-MacBookAir final % git add .
ihamin@ihamin-ui-MacBookAir final % git commit -m "code merge, 팀원소개텍스트 수정"
[release 295dbcd] code merge, 팀원소개텍스트 수정
 1 file changed, 1 insertion(+), 7 deletions(-)
ihamin@ihamin-ui-MacBookAir final % git push origin release
Enumerating objects: 17, done.
Counting objects: 100% (17/17), done.
Delta compression using up to 8 threads
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 2.05 KiB | 2.05 MiB/s, done.
Total 11 (delta 8), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (8/8), completed with 6 local objects.
To https://github.com/dancinncoder/B_team_five_website.git
   7bc4b87..295dbcd  release -> release

 

728x90
반응형