git__04_rebase

AMJ·2023년 3월 13일
0

git_log

목록 보기
4/5

git command


rebase : 공통base를 가진 branch들끼리 합성 / 이사

git checkout [base_branch]
git rebase [new_base_branch]
git rebase --onto [newbase] [upstream] [branch]

Ex.1

  • 2가지 branch rebase


  • branch_experiment로 이동해 master를 base로 Rebase
git checkout experiment
git rebase master

  • 마지막으로 branch_master를 Fast-forward
git checkout master
git merge experiment


Ex.2

  • 3가지 이상 branch rebase

  • branch_server의 C3이 중간에 공통으로 존재


  • branch_master에 branch_client를 rebase
    • C3를 공유하므로 upstream에 server를 포함

git rebase --onto [newbase] [upstream] [branch]
git rebase --onto master server client

  • branch_master를 client C9'에 fast forward

git checkout master
git merge client

  • branch_master에 branch_server를 rebase 및 fast forward

git rebase master server
git checkout master
git merge server

  • 필요없어진 branch 제거

git brach -D client
git brach -D server
profile
재미있는 것들

0개의 댓글