[Git] Git 작업시 main 최신 pull 받아 적용하기

Jang Seok Woo·2022년 7월 5일
1

실무

목록 보기
93/136

settings페이지의 UI 정렬을 수직정렬로 변경해달라는 업무를 받았다.

먼저
fix-settings-ui branch를 만들고,

git checkout -b fix-settings-ui

작업을 하다가~~ 보면,

main브랜치가 업데이트 되어있을 것이다.

그럼 push 전에 main 브랜치를 최신화해두고 push 해야하는데,

main으로 체크아웃하기 위해 작업중이던 작업물을 임시 저장해둔다.

git stash

main으로 checkout한다.

git checkout main
gco main

main의 origin(remote)에 있는 최신코드들을 pull받는다.

git pull

다시 작업중이던 branch로 체크아웃해 넘어간다.

gco fix-settings-ui

최신버전 main을 merge한다.

git merge main --no-ff

그다음 stash에 저장해둔 작업물을 꺼내온다.

git stash pop

그다음 올린다.
add, commit, push

profile
https://github.com/jsw4215

0개의 댓글