Prerequisites
To navigate a stack of branches with the Graphite CLI, make sure you’ve:- Installed and configured the CLI
- Authenticated with GitHub
-
Initialized
gtin a repo of your choice - Created or tracked a branch/stack of branches
gt log
You can use gt log to view the current state of your repository:
Terminal
Check out a branch
Branches in Graphite are justgit branches under the hood—you can check them out with native git, but the easiest way is to use gt checkout:
Terminal
gt checkout (or gt co) in interactive mode:
Terminal
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. Thegt 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.