C.W.K.
Stream
Lesson 04 of 05 · published

Fork와 Pull Request

~22 min · github, pr, fork

Level 0Untracked 새싹
0 XP0/47 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

Fork 는 협업을 push 가 아니라 요청으로 바꿔

Fork-and-pull workflow 는 직접 write 권한 없는 프로젝트에 기여하는 오픈소스 세계의 방식이야. 모양: 프로젝트를 네 계정으로 복사 (fork), 네 fork 의 branch 에서 변경, 그 변경을 Pull Request 로 원본 maintainer 에게 pull 요청. 원본 repo 는 절대 push 권한 안 줘. PR 메커니즘이 직접 push 를 대체하는 요청-검토 채널이야.

기계적으로: GitHub 의 "Fork" 버튼이 네 계정에 server-side 사본 생성. 네 fork 를 local 로 clone 하고 원본을 두 번째 remote 로 추가 (관습적으로 upstream). 일상 흐름: upstream 에서 fetch, fork 의 main 동기화, 새 작업용 branch 분기, 새 branch 를 네 fork 로 push, GitHub 에서 PR 열기. PR description 은 사례 만드는 자리 — 뭐 바꿨고 왜, 검증법, risk.

Fork 동기화 유지가 중요해, 옛 base 에 대한 PR 은 가짜 conflict 를 만들거든. 깔끔한 댄스: git fetch upstream, git switch main, git rebase upstream/main, git push origin main. 이제 네 fork 의 main 이 원본을 거울. 이 시점에서 main 분기하면 깨끗하게 적용되는 PR. GitHub web UI 도 'Sync fork' 버튼이 같은 일을 터미널 없이 해줘.

PR 자체가 사회적 산출물이야. 제목은 imperative, 가능하면 Conventional Commits prefix. description 은 진짜 섹션: what, why, how to test, 시각적이면 screenshot, breaking change 있으면 명시. issue 링크. PR 은 집중 — 한 PR 에 한 관심사. Reviewer 가 코멘트, 너는 같은 branch 에 commit 더 push (PR 자동 업데이트), 승인되면 maintainer merge. Merge 후 양쪽에서 branch 삭제. 다음 pull 때 네 fork main 이 새 history 와 동기화.

Code

Fork-clone-branch-PR 사이클·bash
# 1. GitHub 에서 Fork (브라우저), 네 fork clone:
git clone git@github.com:YOU/repo.git
cd repo

# 2. 원본을 upstream 으로 추가:
git remote add upstream https://github.com/ORIGINAL/repo.git
git remote -v
# origin    git@github.com:YOU/repo.git
# upstream  https://github.com/ORIGINAL/repo.git

# 3. 최신 upstream main 에서 분기:
git fetch upstream
git switch -c fix/typo-readme upstream/main

# 4. 편집, commit, 네 fork 로 push:
git add README.md
git commit -m "docs: fix install command typo"
git push -u origin fix/typo-readme

# 5. GitHub 에서 YOU:fix/typo-readme → ORIGINAL:main 로 PR 열기
Fork main 동기화 유지·bash
git fetch upstream
git switch main
git rebase upstream/main      # 또는 merge — 프로젝트 정책 따름
git push origin main          # GitHub 의 fork main 동기화

# main 에서 새 branch 시작 전마다 반복

External links

Exercise

GitHub 에서 작은 오픈소스 프로젝트 fork. fork clone, upstream 추가, main 동기화. 작은 doc 변경 (오타, README 보완) 으로 branch 만들어. fork 로 push, PR 열기. PR template 필드들 따라가면서 what/why/how-to-verify 섹션 있는 진짜 description 작성. PR ship 안 해도 됨 — workflow 끝까지 관찰만.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.