코딩과 결혼합니다

git 에러 push/pull 본문

2세/Git

git 에러 push/pull

코딩러버 2023. 7. 18. 15:45
728x90

  ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/mini-project-evey-team/four-cuts-backend.git'

내가 시도해본 해결 방법

git pull --rebase  [원격저장소별칭] [브랜치] *

=> git pull --rebase origin main

 

실패

 

이유 : push를 main이 아닌 feature/write-post-function 에 해야하는데 main에 넣으려 해서 오류가 생긴 것이었다.

해결 : git push --set-upstream origin feature/write-post-function

 


error: Your local changes to the following files would be overwritten by merge:
        src/main/resources/application.properties
Please commit your changes or stash them before you merge.
Aborting
Updating 25a7a40..d5ca221

 

내가 시도해본 해결 방법

main으로 브랜치를 바꾸고 git pull

 

실패

 

이유 : properties가 충돌해서 에러가 남

해결 : $ git stash

 

이 경우 stash명령어를 통해 해결할 수 있다. 현재 경로의 버전관리되고있는 내용을 임시저장해둔 것.
나중에 필요하면 임시 저장한 내용을 불러올 수 있음. 그런데 앞으로 쓸 일이 없을 것 같아서 나중에 문제가 생기면 삭제해야겠다.