본문 바로가기
Git

Fork Repository 를 Parent Repository와 동기화

by 엑츄얼리 2022. 4. 27.

Fork해온 Repository는 자동으로 Parent Repository와 동기화되지 않는다.

이를 수동으로 해결해야 하는데, Fork Repository를 정말 조심히 만져야 진행될 것 같다.

일단 이 포스팅의 전제는 Fork Repository를 건들지 않았다는 가정이다.

(건드리고 해봤는데 피똥쌌다...)

 

1. Local Repository에 Fork Repository를 저장

git clone [Fork Repository 주소]

 

 

2. directory를 Local Repository로 이동

 

 

3. Parent Repository를 Local Repository에서 Remote

git remote add upstream [Parent Repository 주소]

 

 

4. 리모트 저장소 확인

git remote -v

git remove -v 결과

 

 

5. Parent Repository 복사

git fetch upstream

 

 

6. local branch 생성 및 remote branch와 연동

 merge를 원하는 브랜치와 하기위해서는 local branch를 생성하고 remote branch와 연동시켜줘야한다.

git checkout -b JK_1 origin/JK_1

 Local Repository JK_1이란 branch를 생성하고 origin/JK_1과 연동

 

 

7. Local Branch - JK_1과 Parent Branch(remote branch) - upstream/JK_1와 연동

git merge upstream/JK_1

 

8. PUSH!!!

git push

이렇게 하면 최신으로 업데이트할 수 있다.

 


이론상으로 JK_1 브랜치를 local에서 사용하고 이를 최신으로 업데이트하고 싶다면,

 

위와 같은 과정이여야할텐데, 오류가 났다. 다시 생각해보고 시도해봐야겠다.

'Git' 카테고리의 다른 글

Intellij에서 STS 프로젝트 Git 연동하여 사용  (0) 2022.05.31
Git 기초 및 실습  (0) 2022.04.26
Git - Learn Git Branching 정리  (0) 2022.04.25

댓글