GitButler ⧓

FeaturesBranch Management

Move branches between stacks

Change branch dependencies by moving branches between stacks or tearing them off into new stacks.

You can drag a branch from one stack to another to change what it depends on. You can also tear a branch off into an independent stack.

Move a branch to another stack

Drag the branch to the position where it belongs in the target stack:

  1. Drag the branch header - Click and hold on the branch header (the section displaying the branch name)
  2. Drop on target location - Drag it to the position where you want to insert it in another stack

When you hover over a valid drop target during the drag operation, you'll see visual indicators showing where the branch will be placed.

Drop zones

There are two types of drop zones when moving branches:

  • Between branches - Drop the branch between two existing branches in a stack to insert it at that position
  • Top of stack - Drop at the top of a stack to make the moved branch the first branch

The drop zones appear as horizontal lines with visual feedback when you hover over them during a drag operation.

Tear a branch off into a new stack

You can also separate a branch from its current stack and create a new independent stack for it. This is called "tearing off" a branch.

Tear off a branch

  1. Drag the branch header - Click and hold on the branch header you want to separate
  2. Drop outside the stacks area - Drag it to the designated dropzone outside of the existing stacks

This creates a new standalone stack containing only that branch.

Requirements

Not all branches can be moved. A branch must meet these conditions to be movable:

  • No conflicts - The branch must not have any merge conflicts
  • Has commits - The branch must contain at least one commit
  • Different target stack - You can only move branches to different stacks (not within the same stack)

What happens during a move

When you move a branch:

  1. Branch is extracted - The branch and its commits are extracted from the source stack
  2. Rebasing occurs - The branch is rebased onto the new base in the target stack
  3. References updated - Git references are updated to reflect the new structure
  4. Stack cleanup - If the moved branch was the last one in its stack, that stack is deleted

Pull request updates

If the branch has an associated pull request or merge request:

  • Pull request bases - Each pull request targets the nearest branch below it that also has a pull request
  • GitHub stack membership - GitButler updates the native stack on GitHub to match the new branch order
  • Description-based stacks - Repositories without native stack support get updated stack information in their pull request descriptions

The synchronization runs on the next push or pull request creation.

Last updated on

On this page

Edit on GitHubGive us feedback