Git Rebase とは?
rebase は、一連の commit を新しいベース commit へ移動し、別の branch の上に 1 つずつ再生する git の操作です。結果は、merge が作るような merge commit のない線形の履歴です。merge の前に feature branch を最新の main で更新するためによく使われます。
なぜ重要か
rebase は履歴をクリーンで線形に保ち、読みやすく bisect しやすくします。注意点は、commit のハッシュを書き換えるため、他の人が既に pull した branch を rebase すると競合を引き起こすことです。一般的なルールは、公開された共有 branch ではなく、ローカルまたは未共有の作業を rebase することです。
関連する概念
- merge と違い、commit の履歴を書き換える
- squash merge は関連する履歴整理の手法
- 共有され既に push された branch の rebase は避ける
関連ガイド
What Is a Squash Merge?A squash merge combines all commits of a pull request into a single commit on the target branch, keeping main…
What Is a Feature Branch?A feature branch is a short-lived branch where a single feature or fix is developed in isolation before mergi…
What Is a Merge Queue?A merge queue serializes pull-request merges, testing each against the latest main, so the branch stays green…