바이오 대표

[Github] Rebase 본문

카테고리 없음

[Github] Rebase

바이오 대표 2022. 1. 9. 17:53

 

여러 개발자들과 함께 코드를 공유 및 병합을 할때 각자 branch에서 수정 후 master branch에 Three-way 로 병합되거나, fast-forward 로 병합된다.  보통 three way merge 는 error debug할때 어떤 branch 에서 발생했는지 찾기 어려움으로 rebase를 이용해서 하나를 base로 fast forward merge 가 가능하게 해서 debug를 좀더 쉽게 할수 있도록 한다.

=> commit historylinearly 확인 할 수 있다.

 

좌: Three-way merge, 우: Fast-forward merge

 

 

< Merge back to master >

$ git merge 

$ git rebase 

-->  changing the base commit that's used for our branch 

$ git checkout [branch name]

$ git rebase [master]

 

* history 를 linearly 보관하면 다른 다른 개발자랑 동시에 commit 을 했을 때 유용하게 사용된다 

* 그냥 merge 해버리면 git이 three-way merge 로 자동 merge 해버릴수 있기 때문에

$ git fetch: put the lastest changes into the origin/master 

$ git rebase origin/mastser 

 

 

git rebase branchname