[Git] push 오류 해결 (Updates were rejected because the tip of your current branch is behind ...)

2021. 8. 28. 21:38·Trouble Shooting
반응형

수정 내용을 push 하려고 했더니 아래와 같은 오류가 나왔다..

 

! [rejected] main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/Seohyun-Roh/js_codingTest.git'
hint: Updates were rejected because the tip of your current branch is behind
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.

 

 

On branch main Your branch and 'origin/main' have diverged,
and have 1 and 2 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)

You have unmerged paths.
(fix conflicts and run "git commit")
(use "git merge --abort" to abort the merge)

Unmerged paths: (use "git add <file>..." to mark resolution)

 

생각해보니 데스크탑에서 작업을 해놓고 깃에 업로드를 해놨었는데 노트북에서 먼저 fetch를 하지 않고 기존의 파일에서 작업을 한 뒤 push를 해서 문제가 있었던 것 같다.

 

대충 이런 상황..

간단하게 아래와 같이 입력해주니 원래의 작업으로 돌아갈 수 있었다!!

 

git reset --hard origin/master

 

앞으로는 버전 관리에 좀 더 신경을 써야겠다..

그리고 스택오버플로우 형님들은 사랑이다. 감사합니다.. 

 

https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-how-to-undiverge-branches/2452610

 

master branch and 'origin/master' have diverged, how to 'undiverge' branches'?

Somehow my master and my origin/master branch have diverged. I actually don't want them to diverge. How can I view these differences and merge them?

stackoverflow.com

 

반응형

'Trouble Shooting' 카테고리의 다른 글

[React] devTool의 Network창에서 'You need to enable JavaScript to run this app.' 메시지 없애기  (0) 2021.10.07
[PowerShell][VSCode] 이 시스템에서 스크립트를 실행할 수 없으므로 ..  (0) 2021.10.06
[VSCode] VSCode 갑자기 실행이 안될 때 해결하기  (0) 2021.09.24
[VSCode] html 자동완성이 안될 때 해결하기  (0) 2021.09.11
[Linux] 하둡 start-all.sh Permission denied(publickey, passwd) 문제 해결  (0) 2021.04.13
'Trouble Shooting' 카테고리의 다른 글
  • [PowerShell][VSCode] 이 시스템에서 스크립트를 실행할 수 없으므로 ..
  • [VSCode] VSCode 갑자기 실행이 안될 때 해결하기
  • [VSCode] html 자동완성이 안될 때 해결하기
  • [Linux] 하둡 start-all.sh Permission denied(publickey, passwd) 문제 해결
SH_Roh
SH_Roh
  • SH_Roh
    혼자공부끄적끄적
    SH_Roh
  • 전체
    오늘
    어제
    • 분류 전체보기 (159)
      • FE (39)
        • HTML, CSS (3)
        • Javascript (17)
        • React (11)
        • Next.js (4)
      • Network (1)
      • DevOps (4)
      • Git (1)
      • Trouble Shooting (24)
      • Algorithm (41)
        • Python (2)
        • Data Structure, Algorithm (7)
        • Problem Solving (31)
      • Education (23)
        • Elice AI Track (4)
        • Wanted Pre-Onboarding FE Co.. (19)
      • TIL (25)
      • Etc. (1)
        • 회고 (1)
        • 그냥저냥 (0)
  • 링크

    • Github
  • 인기 글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
SH_Roh
[Git] push 오류 해결 (Updates were rejected because the tip of your current branch is behind ...)
상단으로

티스토리툴바