일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- 냥냥
- A. Steed 2: Cruise Control
- 냥이
- 양재맛집
- 치명적 귀여움
- 데이트
- 스코티쉬 스트레이트
- codejam
- 발산
- 카페
- 소호정
- 스파게티
- coffee
- 레스토랑
- 안동국시
- 발산역 근처 카페
- 파머스테이블
- 커플
- 부모님과
- 소호정본점
- CodeJam 2017 Round 1B
- 냥스토리
- RED CAT COFFEE X LOUNGE
- 고양이
- 발산맛집
- CDJ
- 고양이는 언제나 귀엽다
- 스테이크
- 파버스
- 먹기좋은곳
- Today
- Total
hubring
git Fork 한 Repository 동기화 본문
fork한 프로젝트를 기반으로 개발하면서 공통적으로 사용할 기능들을 fech받기 위해 동기화가 필요하였다.
동기화를 위해 원본 Repository의 브랜치 추적이 필요하므로
remote repository를 추가하여야 한다.
1. fork후 내 프로젝트에서 원격으로 바라보고 있는 repository를 확인한다.
$ git remote -v
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
> origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
2. 원격 설정에 원본 repository를 추가한다.
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
3. 추가 확인
$ 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)
4. 원본 repository의 최신 업데이트 내역을 불러온다.
$ 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
5. 업데이트를 적용할 local banch를 선택하여 checkout한다.
$ git checkout master
> Switched to branch 'master'
6. 원본 Repository의 브랜치와 병합하면 동기화 할 수 있다.
$ git merge upstream/master
> Updating a422352..5fdff0f
> Fast-forward
> README | 9 -------
> README.md | 7 ++++++
> 2 files changed, 7 insertions(+), 9 deletions(-)
> delete mode 100644 README
> create mode 100644 README.md
이후 부터는 충돌처리나 필요한 작업을 수행 후 git push를 통해 내 Repository에 저장하면 된다.
원본 Repository에 새로운 업데이트가 생기면 아래 명령어를 통해 새로운 커밋 이력을 내려받을 수 잇다.
$ git pull https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git BRANCH_NAME
참고
https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/working-with-forks
Working with forks - GitHub Docs
Working with forks Forks are often used in open source development on GitHub. About forks→ A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository. You can fetch updates from or
docs.github.com
'git' 카테고리의 다른 글
Github 위키 다른 레포의 위키로 옮기는 방법 (0) | 2021.02.24 |
---|---|
git pull시 "untracked working tree files overwritten" 에러 (0) | 2020.07.11 |