본문 바로가기

Git

[Git] 오리지널 레포지토리에 새로 추가된 브랜치들을 포크한 내 레포지토리에도 가져오기

현재 fork를 한 내 레포지토리에는 없고, 오리지널 레포지토리에만 있는 새로 생성된 브랜치를 포크한 레포지토리로 가져오려고 한다.

 

git remote add upstream [원격 저장소 주소: https://github.com/familymoments/family-moments-BE.git]
// 오리지널 레포를 upstream으로 추가

git remote -v
// 잘 되었는지 확인

git fetch upstream [새로운 브랜치: featrue/commentUpload]
// 새로운 브랜치들을 upstream featrue/commentUpload 이런 식으로 가져옴

git checkout featrue/commentUpload

git push origin featrue/commentUpload
// 내 레포에도 반영

git remote remove upstream
// 원격 저장소 연결 끊기

 

 

참고 자료

https://maktubi.tistory.com/237

 

[Github] fork한 레포를 re-fork 하고 싶을 때 (오리지널 레포에 새로 추가된 브랜치 가져오기)

https://github.com/mijinkoo/2022-1-Euron-Study-Assignments GitHub - mijinkoo/2022-1-Euron-Study-Assignments: Euron 2기 스터디팀 예습·복습 과제 제출 Euron 2기 스터디팀 예습·복습 과제 제출. Contribute to mijinkoo/2022-1-Euron-Stud

maktubi.tistory.com