[git] Fork한 repository update하기

김효진·2021년 2월 1일
0

Fork한 repository를 update 하는 방법

원본 저장소 : 다른 사람꺼
포크 저장소 : 다른 사람꺼를 포크해온 내꺼

1. 내 로컬 PC에 포크 저장소 Clone

$ git clone https://github.com/sjoleee/Algorithm.git

2. Clone 한 프로젝트 디렉토리로 이동

3. 리모트 저장소 확인

$ git remote -v
origin	https://github.com/hy57in/Mangorithm.git (fetch)
origin	https://github.com/hy57in/Mangorithm.git (push)

4. 리모트 저장소에 원본 저장소 추가

$ git remote add upstream https://github.com/hy57in/Mangorithm.git

$ git remote -v 명령어를 입력해보면 upstream으로 원본 저장소가 추가된 것을 확인할 수 있다.

origin	https://github.com/sjoleee/Algorithm.git (fetch)
origin	https://github.com/sjoleee/Algorithm.git (push)
upstream	https://github.com/hy57in/Mangorithm.git (fetch)
upstream	https://github.com/hy57in/Mangorithm.git (push)

5. 원본 저장소 fetch

$ git fetch upstream

6. 원본 저장소 merge

$ git merge upstream/main

7. 포크 저장소로 push

git push

참고 :
다른 블로그
다른 블로그2

profile
맨땅에 헤딩 🐣

0개의 댓글