Notice
Recent Posts
Recent Comments
Link
«   2025/02   »
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
Archives
Today
Total
관리 메뉴

pgg-dev

[Git] fork repository 동기화(최신 버전 유지 시키기) 본문

GIT

[Git] fork repository 동기화(최신 버전 유지 시키기)

pgg-dev 2020. 11. 5. 09:21

1. fork한 저장소를 로컬에 clone

$ git clone https://github.com/pgg-dev/fork_repo.git
Cloning into 'fork_repo'...
remote: Enumerating objects: 91, done.
remote: Total 91 (delta 0), reused 0 (delta 0), pack-reused 91
Unpacking objects: 100% (91/91), done.

로컬의 remote repository 확인

$ git remote -v
origin  https://github.com/pgg-dev/fork_repo.git (fetch)
origin  https://github.com/pgg-dev/fork_repo.git (push)

 

2. remote repository에 동기화 시키고 싶은 원본 repository 저장

$ git remote add upstream https://github.com/owner/original_repo.git​
$ git remote -v
origin  https://github.com/pgg-dev/fork_repo.git (fetch)
origin  https://github.com/pgg-dev/fork_repo.git (push)
upstream        https://github.com/owner/original_repo.git (fetch)
upstream        https://github.com/owner/original_repo.git (push)

 

3. 원본 저장소의 최신 내용을 받아온다.

$ git fetch upstream
remote: Enumerating objects: 486, done.
remote: Counting objects: 100% (486/486), done.
remote: Compressing objects: 100% (149/149), done.
remote: Total 3455 (delta 352), reused 420 (delta 318), pack-reused 2969
Receiving objects: 100% (3455/3455), 19.70 MiB | 7.70 MiB/s, done.
Resolving deltas: 100% (2014/2014), completed with 25 local objects.
From https://github.com/owner/original_repo
 * [new branch]      deploy     -> upstream/deploy
 * [new branch]      ggyu       -> upstream/ggyu
 * [new branch]      hyuk       -> upstream/hyuk
 * [new branch]      master     -> upstream/master
 * [new tag]         v1.0.1     -> v1.0.1

 

4. 받아온 내역을 로컬 저장소로 병합.

$ git merge upstream/master
Updating ce2e5ac..d9219e7
Fast-forward
 .gitignore                                      |      5 +
 .vscode/settings.json                           |      2 +
 README.md                                       |     89 +
 babel.config.js                                 |      7 +
 dist/app.ee039449e377b21566af.js                |    575 -
 dist/arrow.354bdfa763f3542654a4a763c854e58a.png |    Bin 1855 -> 0 bytes
 dist/index.html                                 |     11 -
 dist/react.bundle.ee039449e377b21566af.js       |   2761 -
 dist/vendors.ee039449e377b21566af.js            | 220199 ---------------------
...

 

5. 로컬 저장소로 push

$ git push origin master
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/pgg-dev/fork_repo.git
   ce2e5ac..d9219e7  master -> master
Comments