본문 바로가기

업무

Git 관련

반응형

작업

git add . // 변경 내용 업로드 준비

git status // 변경 내용 적용 상태

git commit -m “comment” // 업로드에 대한 코멘트 작성

git log // 수정 및 업로드 상태 변화 확인

git remote --v // 업로드 경로 확인

git push origin main // 업로드 시작

<aside> 📖 error: failed to push some refs to ~repository경로~

원인 : push시 원격 repository에 있는 파일이 로컬 repository에 없거나 reference가 다른 경우에 reject되며 해당 에러가 발생

해결 : git push --mirror // 동기화

</aside>

Clone, Pull차이

  1. git clone URL주소 // fork한 것 가져오기
  2. git pull URL주소 // 내 Regitpository일 경우

기존 리포지토리 깔끔하게 pull / push

git pull
git add .
git commit -m "clean push"
git push

기존 리포지토리 remote 제거

git remote remove origin

새 리포지토리 remote 추가

git remote add origin <https://github.com/계정/리포지토리>

IntelliJ Git 간단관리

git clone -b ‘원격브랜치이름’ ‘레포지토리URL’

git switch -c ‘브랜치이름’

Git 강제 Push하기

git push origin main --allow-unrelated-histories

Git init후 add시 주의사항

Git init후 add시 디렉토리 지정 안하면 다른 파일이 섞일 수 있다..

미리 작성한 프로젝트 원격저장소에 Push진행

// push 진행시 에러발생
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec origin does not match any
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// pull을 진행해서 remote 저장소와 맞춰줌
/c/6s/developer/Project_JAVA/solo (master)
$ git pull git@github.com:DerekYook/Yook-s_Bar.git
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), 1.47 KiB | 71.00 KiB/s, done.
From github.com:DerekYook/Yook-s_Bar
 * branch            HEAD       -> FETCH_HEAD
fatal: refusing to merge unrelated histories

// main위치가 맞지 않다는 에러가 남음
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// fetch로 동기화 진행
/c/6s/developer/Project_JAVA/solo (master)
$ git fetch origin main
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// 증상 동일
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// 로컬저장소와 리모트 저장소의 브랜치 문제로 생각되어 일치 시켜봄
/c/6s/developer/Project_JAVA/solo (master)
$ git branch -m master main

// 증상동일 하지만 에러가 바뀜
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
To github.com:DerekYook/Yook-s_Bar.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.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.

// 히스토리관계없이 pull시킴
/c/6s/developer/Project_JAVA/solo (main)
$ git pull origin main --allow-unrelated-histories
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.
 README.md | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 README.md

// 정상 push 진행됨
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 63.57 KiB | 357.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:DerekYook/Yook-s_Bar.git
   46861d2..13afa2d  main -> main

/c/6s/developer/Project_JAVA/solo (main)
$ 

Pull Request 지우기

PR은 원칙적으로 삭제가 불가능하다. 따라서 지우기 위해서는 GitHub Support의 도움이 필요하다.

지원 티켓 보기 및 업데이트 - GitHub Docs

우측 상단에 내 티켓

버튼을 타고 들어가면 먼저 챗봇과 채팅을 하게된다.

Enterprise를 사용하는지 본인의 저장소인지 묻는데 설정된대로 선택해서 진행하면 된다.

그리고 완료를 하게 되면 요청을 작성하는 화면이 나타나게 되는데 나의 경우에는 두가지가 필요했다.

  1. PR을 지울 저장소의 URL
  2. Full Commit Code

URL은 그냥 알려주면 되고 Full Commit Code의 경우에는 PR을 올린 Commit에 들어가보면 복사가 가능하니 복사 붙여넣기 하면된다.

그리고 기다리면 생각보다 빠른 처리를 해준다.

Your branch is ahead of 'origin/main' by # commits

로컬에서 작업한 내용이 브랜치에 올라갔는데 Main에 commit이 반영되지 않고 PR이 되지 않은 상태로 작업했을 때 나는 에러

Github에서 main으로 PR도 불가능

로컬에서 작업한 내용이 올라가면서 꼬인거라 재정비함

  1. 로컬에서 현재 작업 브랜치를 main브랜치로 변경해줌 ⇒ git checkout main
  2. 기존 브랜치 작업물 로컬의 main브랜치로 병합 ⇒ git merge main 작업브랜치
  3. 한번 더 동기화 확인 ⇒ git fetch origin main / git pull origin main
  4. 원격의 main으로 push ⇒ git push origin main

하지만 이 방법은 개인 repo이기에 가능하지 실제 업무에서 main에 바로 올린다는 것은 말이 안될 것이라서…. 다른 방법도 고안해봐야 할듯

Git 관련

작업

git add . // 변경 내용 업로드 준비

git status // 변경 내용 적용 상태

git commit -m “comment” // 업로드에 대한 코멘트 작성

git log // 수정 및 업로드 상태 변화 확인

git remote --v // 업로드 경로 확인

git push origin main // 업로드 시작

<aside> 📖 error: failed to push some refs to ~repository경로~

원인 : push시 원격 repository에 있는 파일이 로컬 repository에 없거나 reference가 다른 경우에 reject되며 해당 에러가 발생

해결 : git push --mirror // 동기화

</aside>

Clone, Pull차이

  1. git clone URL주소 // fork한 것 가져오기
  2. git pull URL주소 // 내 Regitpository일 경우

기존 리포지토리 깔끔하게 pull / push

git pull
git add .
git commit -m "clean push"
git push

기존 리포지토리 remote 제거

git remote remove origin

새 리포지토리 remote 추가

git remote add origin <https://github.com/계정/리포지토리>

IntelliJ Git 간단관리

git clone -b ‘원격브랜치이름’ ‘레포지토리URL’

git switch -c ‘브랜치이름’

Git 강제 Push하기

git push origin main --allow-unrelated-histories

Git init후 add시 주의사항

Git init후 add시 디렉토리 지정 안하면 다른 파일이 섞일 수 있다..

미리 작성한 프로젝트 원격저장소에 Push진행

// push 진행시 에러발생
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec origin does not match any
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// pull을 진행해서 remote 저장소와 맞춰줌
/c/6s/developer/Project_JAVA/solo (master)
$ git pull git@github.com:DerekYook/Yook-s_Bar.git
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), 1.47 KiB | 71.00 KiB/s, done.
From github.com:DerekYook/Yook-s_Bar
 * branch            HEAD       -> FETCH_HEAD
fatal: refusing to merge unrelated histories

// main위치가 맞지 않다는 에러가 남음
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// fetch로 동기화 진행
/c/6s/developer/Project_JAVA/solo (master)
$ git fetch origin main
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// 증상 동일
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// 로컬저장소와 리모트 저장소의 브랜치 문제로 생각되어 일치 시켜봄
/c/6s/developer/Project_JAVA/solo (master)
$ git branch -m master main

// 증상동일 하지만 에러가 바뀜
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
To github.com:DerekYook/Yook-s_Bar.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.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.

// 히스토리관계없이 pull시킴
/c/6s/developer/Project_JAVA/solo (main)
$ git pull origin main --allow-unrelated-histories
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.
 README.md | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 README.md

// 정상 push 진행됨
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 63.57 KiB | 357.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:DerekYook/Yook-s_Bar.git
   46861d2..13afa2d  main -> main

/c/6s/developer/Project_JAVA/solo (main)
$ 

Pull Request 지우기

PR은 원칙적으로 삭제가 불가능하다. 따라서 지우기 위해서는 GitHub Support의 도움이 필요하다.

지원 티켓 보기 및 업데이트 - GitHub Docs

우측 상단에 내 티켓

버튼을 타고 들어가면 먼저 챗봇과 채팅을 하게된다.

Enterprise를 사용하는지 본인의 저장소인지 묻는데 설정된대로 선택해서 진행하면 된다.

그리고 완료를 하게 되면 요청을 작성하는 화면이 나타나게 되는데 나의 경우에는 두가지가 필요했다.

  1. PR을 지울 저장소의 URL
  2. Full Commit Code

URL은 그냥 알려주면 되고 Full Commit Code의 경우에는 PR을 올린 Commit에 들어가보면 복사가 가능하니 복사 붙여넣기 하면된다.

그리고 기다리면 생각보다 빠른 처리를 해준다.

Your branch is ahead of 'origin/main' by # commits

로컬에서 작업한 내용이 브랜치에 올라갔는데 Main에 commit이 반영되지 않고 PR이 되지 않은 상태로 작업했을 때 나는 에러

Github에서 main으로 PR도 불가능

로컬에서 작업한 내용이 올라가면서 꼬인거라 재정비함

  1. 로컬에서 현재 작업 브랜치를 main브랜치로 변경해줌 ⇒ git checkout main
  2. 기존 브랜치 작업물 로컬의 main브랜치로 병합 ⇒ git merge main 작업브랜치
  3. 한번 더 동기화 확인 ⇒ git fetch origin main / git pull origin main
  4. 원격의 main으로 push ⇒ git push origin main

하지만 이 방법은 개인 repo이기에 가능하지 실제 업무에서 main에 바로 올린다는 것은 말이 안될 것이라서…. 다른 방법도 고안해봐야 할듯

Git 관련

작업

git add . // 변경 내용 업로드 준비

git status // 변경 내용 적용 상태

git commit -m “comment” // 업로드에 대한 코멘트 작성

git log // 수정 및 업로드 상태 변화 확인

git remote --v // 업로드 경로 확인

git push origin main // 업로드 시작

<aside> 📖 error: failed to push some refs to ~repository경로~

원인 : push시 원격 repository에 있는 파일이 로컬 repository에 없거나 reference가 다른 경우에 reject되며 해당 에러가 발생

해결 : git push --mirror // 동기화

</aside>

Clone, Pull차이

  1. git clone URL주소 // fork한 것 가져오기
  2. git pull URL주소 // 내 Regitpository일 경우

기존 리포지토리 깔끔하게 pull / push

git pull
git add .
git commit -m "clean push"
git push

기존 리포지토리 remote 제거

git remote remove origin

새 리포지토리 remote 추가

git remote add origin <https://github.com/계정/리포지토리>

IntelliJ Git 간단관리

git clone -b ‘원격브랜치이름’ ‘레포지토리URL’

git switch -c ‘브랜치이름’

Git 강제 Push하기

git push origin main --allow-unrelated-histories

Git init후 add시 주의사항

Git init후 add시 디렉토리 지정 안하면 다른 파일이 섞일 수 있다..

미리 작성한 프로젝트 원격저장소에 Push진행

// push 진행시 에러발생
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec origin does not match any
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// pull을 진행해서 remote 저장소와 맞춰줌
/c/6s/developer/Project_JAVA/solo (master)
$ git pull git@github.com:DerekYook/Yook-s_Bar.git
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), 1.47 KiB | 71.00 KiB/s, done.
From github.com:DerekYook/Yook-s_Bar
 * branch            HEAD       -> FETCH_HEAD
fatal: refusing to merge unrelated histories

// main위치가 맞지 않다는 에러가 남음
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// fetch로 동기화 진행
/c/6s/developer/Project_JAVA/solo (master)
$ git fetch origin main
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// 증상 동일
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// 로컬저장소와 리모트 저장소의 브랜치 문제로 생각되어 일치 시켜봄
/c/6s/developer/Project_JAVA/solo (master)
$ git branch -m master main

// 증상동일 하지만 에러가 바뀜
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
To github.com:DerekYook/Yook-s_Bar.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.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.

// 히스토리관계없이 pull시킴
/c/6s/developer/Project_JAVA/solo (main)
$ git pull origin main --allow-unrelated-histories
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.
 README.md | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 README.md

// 정상 push 진행됨
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 63.57 KiB | 357.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:DerekYook/Yook-s_Bar.git
   46861d2..13afa2d  main -> main

/c/6s/developer/Project_JAVA/solo (main)
$ 

Pull Request 지우기

PR은 원칙적으로 삭제가 불가능하다. 따라서 지우기 위해서는 GitHub Support의 도움이 필요하다.

지원 티켓 보기 및 업데이트 - GitHub Docs

 

지원 티켓 보기 및 업데이트 - GitHub Docs

지원 티켓을 보고 GitHub 지원 포털을 사용하여 GitHub 지원에 응답할 수 있습니다.

docs.github.com

우측 상단에 내 티켓

버튼을 타고 들어가면 먼저 챗봇과 채팅을 하게된다.

Enterprise를 사용하는지 본인의 저장소인지 묻는데 설정된대로 선택해서 진행하면 된다.

그리고 완료를 하게 되면 요청을 작성하는 화면이 나타나게 되는데 나의 경우에는 두가지가 필요했다.

  1. PR을 지울 저장소의 URL
  2. Full Commit Code

URL은 그냥 알려주면 되고 Full Commit Code의 경우에는 PR을 올린 Commit에 들어가보면 복사가 가능하니 복사 붙여넣기 하면된다.

그리고 기다리면 생각보다 빠른 처리를 해준다.

Your branch is ahead of 'origin/main' by # commits

로컬에서 작업한 내용이 브랜치에 올라갔는데 Main에 commit이 반영되지 않고 PR이 되지 않은 상태로 작업했을 때 나는 에러

Github에서 main으로 PR도 불가능

로컬에서 작업한 내용이 올라가면서 꼬인거라 재정비함

  1. 로컬에서 현재 작업 브랜치를 main브랜치로 변경해줌 ⇒ git checkout main
  2. 기존 브랜치 작업물 로컬의 main브랜치로 병합 ⇒ git merge main 작업브랜치
  3. 한번 더 동기화 확인 ⇒ git fetch origin main / git pull origin main
  4. 원격의 main으로 push ⇒ git push origin main

하지만 이 방법은 개인 repo이기에 가능하지 실제 업무에서 main에 바로 올린다는 것은 말이 안될 것이라서…. 다른 방법도 고안해봐야 할듯

Git 관련

작업

git add . // 변경 내용 업로드 준비

git status // 변경 내용 적용 상태

git commit -m “comment” // 업로드에 대한 코멘트 작성

git log // 수정 및 업로드 상태 변화 확인

git remote --v // 업로드 경로 확인

git push origin main // 업로드 시작

<aside> 📖 error: failed to push some refs to ~repository경로~

원인 : push시 원격 repository에 있는 파일이 로컬 repository에 없거나 reference가 다른 경우에 reject되며 해당 에러가 발생

해결 : git push --mirror // 동기화

</aside>

Clone, Pull차이

  1. git clone URL주소 // fork한 것 가져오기
  2. git pull URL주소 // 내 Regitpository일 경우

기존 리포지토리 깔끔하게 pull / push

git pull
git add .
git commit -m "clean push"
git push

기존 리포지토리 remote 제거

git remote remove origin

새 리포지토리 remote 추가

git remote add origin <https://github.com/계정/리포지토리>

IntelliJ Git 간단관리

git clone -b ‘원격브랜치이름’ ‘레포지토리URL’

git switch -c ‘브랜치이름’

Git 강제 Push하기

git push origin main --allow-unrelated-histories

Git init후 add시 주의사항

Git init후 add시 디렉토리 지정 안하면 다른 파일이 섞일 수 있다..

미리 작성한 프로젝트 원격저장소에 Push진행

// push 진행시 에러발생
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec origin does not match any
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// pull을 진행해서 remote 저장소와 맞춰줌
/c/6s/developer/Project_JAVA/solo (master)
$ git pull git@github.com:DerekYook/Yook-s_Bar.git
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), 1.47 KiB | 71.00 KiB/s, done.
From github.com:DerekYook/Yook-s_Bar
 * branch            HEAD       -> FETCH_HEAD
fatal: refusing to merge unrelated histories

// main위치가 맞지 않다는 에러가 남음
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// fetch로 동기화 진행
/c/6s/developer/Project_JAVA/solo (master)
$ git fetch origin main
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main

// commit은 되었는지 체크
/c/6s/developer/Project_JAVA/solo (master)
$ git log
commit fe847a57a308218a2c2b72bfdaef63182e481de2 (HEAD -> master)
Author: DerekYook <wowykd@gmail.com>
Date:   Mon Apr 24 23:38:37 2023 +0900

    init

// 증상 동일
/c/6s/developer/Project_JAVA/solo (master)
$ git push origin main
error: src refspec main does not match any
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.git'

// 로컬저장소와 리모트 저장소의 브랜치 문제로 생각되어 일치 시켜봄
/c/6s/developer/Project_JAVA/solo (master)
$ git branch -m master main

// 증상동일 하지만 에러가 바뀜
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
To github.com:DerekYook/Yook-s_Bar.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'github.com:DerekYook/Yook-s_Bar.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.

// 히스토리관계없이 pull시킴
/c/6s/developer/Project_JAVA/solo (main)
$ git pull origin main --allow-unrelated-histories
From github.com:DerekYook/Yook-s_Bar
 * branch            main       -> FETCH_HEAD
Merge made by the 'ort' strategy.
 README.md | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 README.md

// 정상 push 진행됨
/c/6s/developer/Project_JAVA/solo (main)
$ git push origin main
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 16 threads
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 63.57 KiB | 357.00 KiB/s, done.
Total 6 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), done.
To github.com:DerekYook/Yook-s_Bar.git
   46861d2..13afa2d  main -> main

/c/6s/developer/Project_JAVA/solo (main)
$ 

Pull Request 지우기

PR은 원칙적으로 삭제가 불가능하다. 따라서 지우기 위해서는 GitHub Support의 도움이 필요하다.

지원 티켓 보기 및 업데이트 - GitHub Docs

우측 상단에 내 티켓

버튼을 타고 들어가면 먼저 챗봇과 채팅을 하게된다.

Enterprise를 사용하는지 본인의 저장소인지 묻는데 설정된대로 선택해서 진행하면 된다.

그리고 완료를 하게 되면 요청을 작성하는 화면이 나타나게 되는데 나의 경우에는 두가지가 필요했다.

  1. PR을 지울 저장소의 URL
  2. Full Commit Code

URL은 그냥 알려주면 되고 Full Commit Code의 경우에는 PR을 올린 Commit에 들어가보면 복사가 가능하니 복사 붙여넣기 하면된다.

그리고 기다리면 생각보다 빠른 처리를 해준다.

Your branch is ahead of 'origin/main' by # commits

로컬에서 작업한 내용이 브랜치에 올라갔는데 Main에 commit이 반영되지 않고 PR이 되지 않은 상태로 작업했을 때 나는 에러

Github에서 main으로 PR도 불가능

로컬에서 작업한 내용이 올라가면서 꼬인거라 재정비함

  1. 로컬에서 현재 작업 브랜치를 main브랜치로 변경해줌 ⇒ git checkout main
  2. 기존 브랜치 작업물 로컬의 main브랜치로 병합 ⇒ git merge main 작업브랜치
  3. 한번 더 동기화 확인 ⇒ git fetch origin main / git pull origin main
  4. 원격의 main으로 push ⇒ git push origin main

하지만 이 방법은 개인 repo이기에 가능하지 실제 업무에서 main에 바로 올린다는 것은 말이 안될 것이라서…. 다른 방법도 고안해봐야 할듯

반응형

'업무' 카테고리의 다른 글

Asterisk 설치(1)  (0) 2023.08.29
DBeaver CSV Export 한글깨짐  (0) 2023.08.16
JAVA & Python Install  (0) 2022.07.23
스케줄러  (0) 2022.06.28
Batch 파일 / 폴더 호출, 프로그램 호출  (0) 2022.06.21