:::: MENU ::::

Github – Fork한 repo를 업데이트 하기

Github에서  Fork한  repo를 원본과 싱크를 맞추어 업데이트하려면… Fork한 repo를 셋업하고 local clone을 만든다.

$ git clone https://github.com/YOUR-USERNAME/xxxx.git

그리고 이것을 original과 sync하려면 먼저 리모트 설정하고 패치를 하면 된다. local clone의 위치로 이동을 하고..

$ git remote add upstream https://github.com/xxxx/xxxx.git

확인

$ git remote -v
# origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
# origin    https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
# upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch)
# upstream  https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)

패치

$ git fetch upstream
# remote: Counting objects: 75, done.
# remote: Compressing objects: 100% (53/53), done.
# remote: Total 62 (delta 27), reused 44 (delta 9)
# Unpacking objects: 100% (62/62), done.
# From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
#  * [new branch]      master     -> upstream/master

체크아웃

$ git checkout -b master
# Switched to branch 'master'

참고

https://help.github.com/articles/fork-a-repo/

https://help.github.com/articles/syncing-a-fork/