협업 도중, git 원격저장소에 push가 되지 않는 문제가 발생했다.
% git push origin main
To https://github.com/원격저장소
! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/원격저장소'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
hint를 보면 로컬저장소의 branch tip이 원격저장소보다 뒤에 있다는 것 같다.
% git status
interactive rebase in progress; onto 585ce12
git status을 입력하자 위와 같이 확인됐고, 해결방법을 찾을 수 있었다.
나는 충돌 해결 후 git rebase --continue을 하지않았기 때문에 main이 한참 뒤에 있었다. git add 및 git rebase --continue을 꼭 해야한다.
해결방법: branch 병합 후 충돌이 발생했을 경우, 충돌이 발생한 파일을 수정한 뒤 git rebase --continue을 해야한다.
git rebase --continue 전
% git log --oneline

git rebase --continue 후
% git rebase --continue
% git log --oneline

% git push origin main
% git log --oneline
