Git Rebasing: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:


Be aware that rebasing [[#Rewriting_History|rewrites history]].
Be aware that rebasing [[#Rewriting_History|rewrites history]].
When two branches are involved in rebasing (and in merging in general), we use the following terminology: the branch the changes to merge come from is named the "head" branch, and the brach to merge into is named the "base" branch.


=Simple Rebasing=
=Simple Rebasing=

Revision as of 17:11, 6 August 2019

Internal

Overview

Be aware that rebasing rewrites history.

When two branches are involved in rebasing (and in merging in general), we use the following terminology: the branch the changes to merge come from is named the "head" branch, and the brach to merge into is named the "base" branch.

Simple Rebasing

Only two branches are involved.

More Complex Rebasing

Rewriting History

Rebasing removes the commits that have been applied to the target branch from repository.

Practical Use Cases

Moving a Branch Forward

You are working on a feature branch, named "A", created when the "develop" branch HEAD was commit "ef5". You committed work on the "A" branch, and your commit is "3ba". After a while, you want to apply your changes on the HEAD of "develop", since "develop" has evolved and you want to try

On branch task/of/PLAT-15252
Your branch and 'origin/task/of/PLAT-15252' have diverged,
and have 164 and 1 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

Rebasing at the HEAD of the Base Branch