Visualize a stack
To visualize a stack of branches with the Graphite CLI, make sure you've:
gtin a repo of your choice
Created or tracked a branch or stack of branches
Using a stacked changes workflow allows you to easily visualize the dependencies between all of your branches, pull down other teammate's branches to collaborate, and even view multiple stacks of changes at once.
Graphite provides three ways to visualize your stack, ranging from extremely detailed with lots of metadata, to very simple and to-the-point.
This is one of the most commonly used
log commands to view a stack of branches:
> gt log◉ pp--06-14-part_3 (current)│ 8 seconds ago││ 95338df - part 3│◯ pp--06-14-part_2│ 8 seconds ago││ 95610c6 - part 2│◯ pp--06-14-part_1│ 27 seconds ago││ 48cd85e - part 1│◯ main│ 5 weeks ago│
short subcommand allows you to quickly navigate and switch between branches in a stack.
> gt log short◉ pp--06-14-part_3◯ pp--06-14-part_2◯ pp--06-14-part_1◯ main
The output of
log long shows the the current
git history instead of the Graphite view:
> gt log long* 95338df - (7 minutes ago) part 3 - Pranathi Peri (pp--06-14-part_3)* 95610c6 - (7 minutes ago) part 2 - Pranathi Peri (pp--06-14-part_2)* 48cd85e - (8 minutes ago) part 1 - Pranathi Peri (pp--06-14-part_1)* 68722ac - [Product] Add TicTacToe react game frontend (#133) - Nicholas Yan (origin/main, origin/HEAD, main)* c651c74 - [Product] Add server for TicTacToe react game (#132) - Nicholas Yan* eec07e3 - [Product] Add API for TicTacToe react game (#131) - Nicholas Yan
log short both support a series of optional flags. Since
log long is just a shortcut for the aforementioned
git command, it doesn't have the same customizability.
gt log --stack: shows the direct descendants and ancestors of the current PR. By default the commands show all branches currently tracked with Graphite.
gt log --steps <n>: implies
--stackbut only shows n levels of descendants and ancestors.
gt log --reverse: displays the log with
trunk(also known as
main) at the top instead of the bottom. Useful for larger stacks to keep their tips near the bottom of the output.
Once you've submitted your branches with Graphite,
gt log also includes a link to the PR page and some details about its status.
You can view information for one branch at a time with
gt branch info. By default this shows the children and parents of the branch, as well as the descriptions for each commit in the branch. There are also
--patch options to see the PR description (if one exists) and the changesets of each commit.