TIL/Git
Git | revert
홍차23
2020. 10. 15. 23:29
git push 를 했더니
error: failed to push some refs to
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
= 현재 로컬 파일과 원격저장소 파일의 불일치 때문에 나오는 에러
1) git pull //원격저장소에 있는 파일을 받아온다.
2) 두개가 다르기 때문에 충돌이 발생한다.
3) git revert 'commit번호' //원격저장소에 있던 파일을 버리고 현재 로컬에 있던 파일을 선택하기 위해서, 바로 직전 커밋을 revert 한다.
4) git push
참고: revert 와 reset 차이