[Spring] git 협업하기

Feb 29, 2024
[Spring] git 협업하기
 
💡
git remote add origin 주소 // 원격지 연결
 
git fetch master // 다운
 
git merge origin/master //오리진/마스터 가지를 마스터로 머지함
 
git pull origin master// 패치와 머지를 같이 함.
 
git clone 주소 // 원격지의 코드를 다운 받음. git init, 패치 머지 모두 포함.
 

1. git clone 원격지에서 내려받기

 
git clone 주소
 
notion image
 

2. 브랜치 보호

 
💡
한 명이 push를 할 때 승인을 해야만 가능하도록 설정
 
notion image
 
notion image
 
권한을 제한할 branch 명을 정한다.
pull request : 다른 브랜치를 머지하는 것. 승인해야 인원을 설정한다.
push를 하면 승인되지 않고 대기상태가 됨. 누군가 승인을 해야됨.
 
 

3. git pull request

 
notion image
 
새로운 브랜치를 만듬.
 
 
notion image
 
pull request - compare & request
 
 
notion image
 
내용을 작성하고 create pull request 입
 
notion image
 
승인이 완료되면 merge pull request가 활성화. 누르면 merge가 된다.
 
notion image
 
master 브랜치에 merge 되어 있다.
 
💡
팀원은 각자의 브랜치에서 pull request 요청을 한다. 개발 완성되면 master 브랜치로 옮겨서 전체 코드를 다운받고, 다시 각자의 브랜치로 이동한 후 새로운 기능을 개발한다. 협업의 핵심은 형상을 동기화하는 것. 먼저 원격지에서 다운을 받아서 동기화 후 push. 그래야 충돌이 나도 원격지에서 충돌이 나지 않음.
 
 

4. git pull

 
git pull origin master
 
notion image
 
notion image
 
github에 있던 파일을 로컬로 내려받았다.
 
 
 
 
 
Share article
RSSPowered by inblog