git push시 none-fast-forward 문제 해결하기

단위별로 push하던 중에 다음과 같은 에러가 발생하였다.

1
2
3
4
5
6
! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/Deep-brain-Academy-2
hint: Updates were rejected because the tip of your current branch is behin
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

기존에 게시글로 작성하였던 git stash를 사용하여 해결하였다.

1
2
3
4
5
git add .
git commit -m "commit msg"
git stash
git pull origin main
git push origin

댓글