Moving Branches
Learn how to reorganize your branches by moving them between different stacks
Overview
GitButler allows you to move branches between stacks through a simple drag-and-drop interface. This is useful when you want to reorganize your work, change branch dependencies, or consolidate related branches into a single stack.
Moving a Branch to Another Stack
You can move a branch from one stack to another by dragging it to a specific position in the target stack.
How to Move a Branch
- Drag the branch header - Click and hold on the branch header (the section displaying the branch name)
- 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.
Creating a New Stack (Tearing Off)
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.
How to Tear Off a Branch
- Drag the branch header - Click and hold on the branch header you want to separate
- Drop outside the stacks area - Drag it to the designated dropzone outside of the existing stacks
This creates a new standalone stack containing just that branch.
Important Considerations
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:
- Branch is extracted - The branch and its commits are extracted from the source stack
- Rebasing occurs - The branch is rebased onto the new base in the target stack
- References updated - Git references are updated to reflect the new structure
- Stack cleanup - If the moved branch was the last one in its stack, that stack is deleted
Pull Request Updates
If you're using GitHub integration and the branch has an associated pull request:
- PR descriptions are automatically updated - The PR base and description are updated to reflect the new stack structure
- Stack PRs are synchronized - All PRs in both the source and target stacks have their descriptions updated to maintain proper stacking information
Related Features
- Stacked Branches - Learn about working with stacked branches
- Branch Lanes - Understand the branch lane interface
- Virtual Branches - Core concepts of GitButler's virtual branch system
Last updated on