Collaboration Workflow

조윤수·2025년 1월 2일

Git 공부

목록 보기
3/4

1. Centralized Workflow

모두가 main barnch에서 작업한다. main이 local이랑 git repo랑 다르면 무조건 pull을 하고 merge하고 push 해야 된다.

이 때 충돌이 발생할 수 있으므로 비추!

pull -> merge -> push // merge도 하나의 commit
remote name = origin

2. Feature branch

feature branch에서 작업하기!
아무도 main에서 일하지 않고 feature에서 작업하고 완성했을 때만 master에 merge 한다. 이 때는 main branch가 local하고 git repo하고 차이가 없으면 pull을 하지 않고 그냥 push 가능하다.

3. Pull request

feature branch에서 main branch에 pull 요청을 보내고 승인, 병합을 기다리는 것이다. pull requset는 요청으로 바로 merge하지 않는다.

a <- new branch // new branch를 a로 merge한다.

4. 로컬에서 작업한 내용을 원격 저장소의 master 브랜치와 통합하는 과정

전체 flow
1. 원격 저장소에서 최신 변경사항을 가져온다.
2. my-new-feature 브랜치로 이동 후 master의 변경사항을 병합
3. 충돌을 해결하고 master에서 my-new-feature 변경사항을 병합
4. master 브랜치의 최신 상태를 원격 저장소에 push

세부 flow
git fetch origin // 원격저장소 origin에서 최신 변경사항을 로컬 저장소로 가지고 온다.
git switch my-new-feature // 브랜치 전환
git merge master // 합병
fix conflicts! // 충돌 해결

git switch master // master branch로 전환
git merge my-new-feature // my-new-feature엣 해결한 충돌은 master 에 통합
git push origin master // 원격 저장소에 push

출처

https://www.udemy.com/course/git-and-github-bootcamp/?couponCode=ST12MT122624
https://git-scm.com/video/what-is-git

profile
동국대학교 정보통신공학과

0개의 댓글