Tower Icon

Merging & Rebasing

To bring changes from one branch into another you have two options: merge or rebase. Tower allows you to update your current HEAD branch using either strategy.

To merge a branch into your HEAD branch

The most common method to integrate one branch into another is to perform a „merge“. For an ordinary three-way merge, Git takes the endpoints of the branches to be merged and the common parent commit as the basis for the integration. This results in a so-called „merge commit“ that connects both branches like a knot.

Perform one of the following actions:

  • In the Sidebar drag the branch whose changes you want to integrate and drop it onto your HEAD branch.

  • Click the "Merge" toolbar button and select from the following menu which branch you want to integrate with your HEAD branch.

    NOTE: If you want to make sure that a merge commit is created (even in case of a fast-forward), check the "Always Generate Merge Commit" checkbox (which corresponds to using the "--no-ff" option on the command line).

To rebase a branch into your HEAD branch

When doing a rebase, Git takes all the committed changes from one branch and reapplies them (like patches) on the other branch one after the other. Thereby, history is rewritten: It will appear as if the commits would have been made consecutively on the same branch, not on a different branch. No merge commit will be created, but commits will have new SHA1-IDs.
IMPORTANT:As a golden rule you should never rebase commits that have already been published on a remote repository (pushed).

Perform one of the following actions:

  • In the Sidebar drag the branch whose changes you want to integrate and drop it onto your HEAD branch, while keeping the ALT key pressed.

  • Click the "Rebase" toolbar button and select from the following menu which branch you want to integrate with your HEAD branch.

NOTE:Tower will always integrate changes from another branch into your current HEAD branch, not the other way around.


Related Topics

Dealing with merge conflicts

About detached HEADs and orphaned branches