Navigating a stack
Let's say this is the state of your repo - Graphite makes it easy to navigate anywhere in your stack.
Note the 3-stack of review_queue_api, review_queue_server, and review_queue_frontend

Checking 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 branch checkout:
1
# checkout review_queue_server
2
gt branch checkout tr-PK31--review_queue_server
Copied!
If you aren't sure which branch you want to checkout, you can also use gt branch checkout in interactive mode:
gt branch checkout (interactive mode)
Now, if you run gt log you'll be on review_queue_server as intended:

Moving up and down a stack

Upstack: branches further away from main in a stack (more recent)
Downstack: branches closer to main in a stack (less recent)
Sometimes you want to move to the branch directly above or below the current branch in a stack. Graphite's CLI makes this easy:
1
# check out the branch directly up-stack (in this case review_queue_frontend)
2
gt branch up
3
4
# check out the branch directly down-stack (in this case back to review_queue_server)
5
gt branch down
6
7
# move multiple branches at a time (back to main)
8
gt branch down 2
9
as
10
# move multiple branches at a time (back to review_queue_frontend)
11
gt branch up 4
12
13
# move to the base of the stack, not including main (to review_queue_api)
14
gt branch bottom
15
16
# move to the tip of the stack (back to review_queue_frontend)
17
gt branch top
Copied!
If you find yourself navigating a stack which splits into smaller stacks, gt branch up and gt branch top will ask which child branch you'd like to checkout if there's ever ambiguity.
Now that you can quickly navigate your stack, let's take a look at how you can easily update branches mid-stack.