git

[Git] feature branch 업데이트하기

잔망루피 2023. 5. 18. 19:55
반응형

Merge하려고 하는데

This branch is out-of-date with the base branch

가 뜬다.

dev에 merge할 feature 브랜치에 원격 저장소의 최신사항이 반영되도록 해야한다.

 

git checkout dev

feature 브랜치를 merge할 브랜치 dev로 이동

 

git fetch -p origin

 

 

fetch는 원격 저장소에서 branch들과 commit들을 가져온다.

-p는 --prune 옵션이고, 원격 저장소에서 더이상 존재하지 않는 것들을 삭제한다.

 

git merge origin/dev

원격 저장소의 브랜치 origin/dev의 변경사항을 로컬 dev 브랜치에 merge한다. origin/dev ➡️ dev

 

git checkout {feature-branch}

feature-branch로 체크아웃한다. ex) git checkout feature/#1

 

git merge dev

dev ➡️ feature브랜치

 

git push origin {feature-branch}

feature브랜치에 push한다. ex) git push origin feature/#1

push하기 전에 자동으로 생성되는 merge 커밋을 수정해도 된다.

 

 


참고 👇👇

https://gist.github.com/whoisryosuke/36b3b41e738394170b9a7c230665e6b9

 

Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date wit

Bring your feature branch up to date with master. Deploying from Git branches adds flexibility. Bring your branch up to date with master and deploy it to make sure everything works. If everything l...

gist.github.com

 

반응형