Git rebase
Definition
Git Rebase transfers a sequence of commits onto another starting point, altering their history in the process.
Git Rebase reapplies changes of a commit sequence onto a selected new base. This usually creates new commits with new identifiers. Interactive rebase can additionally edit the order or combination of commits. Conflicts must be deliberately resolved.
Simply explained
You set your changes onto a newer starting point as if you had begun them from there.
Why it matters in practice
Rebase can neatly attach working branches to an updated main branch but requires special coordination if the history is already shared.
Example from business
A possible example: A developer sets their not yet shared feature branch onto the current main branch and then reviews the result.
Limits and pitfalls
- New commit identifiers affect other copies of the history. Uncoordinated rebase of published branches can complicate collaboration; a conflict-free process also does not prove technical correctness.
Origin & history
Rebase is an alternative to preserving branched histories through merge. Both serve integration but represent the development history differently.
Use in mid-sized companies
- A team limits rebase to suitable branches and reviews both the version history and the affected functionality after adoption.
Frequently asked questions
Are the original commit identifiers preserved?
Normally not. New commit objects are created due to the new base, even if their technical changes remain similar.
Sources
- git-rebase. · Git-Projekt (o. J.): git-rebase.
Editorially reviewed on: