Skip to main content

Prerequisites

To navigate a stack of branches with the Graphite CLI, make sure you’ve:

gt log

You can use gt log to view the current state of your repository:
Terminal

Check out a branch

Branches in Graphite are just git branches under the hood—you can check them out with native git, but the easiest way is to use gt checkout:
Terminal
If you aren’t sure which branch you want to checkout, you can also use gt checkout (or gt co) in interactive mode:
Terminal
Now, you can see in gt log short you’re on part_1 as intended:
Terminal

Move up and down a stack

Sometimes you want to move to the branch directly above or below the current branch in a stack. The gt up, gt down, gt top, and gt bottom commands help make this possible. Since gt bottom takes you to the bottom-most branch in your stack not including your trunk branch, you can use gt checkout --trunk/-t, which always takes you to your trunk branch (e.g. main):
Terminal
If you find yourself navigating a complex stack where there are multiple children of a particular branch, gt up and gt top will ask which child branch you’d like to checkout if there’s ever ambiguity.