Viewing a stack
Graphite gives you 3 different ways to visualize your current stack.
Let's continue the example from the previous page and see what our current stack looks like!
gt log (most common)
> 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│
gt log short (compact view)
> gt log short◉ pp--06-14-part_3◯ pp--06-14-part_2◯ pp--06-14-part_1◯ main
gt log long (detailed 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 review queue filter frontend (#133) - Nicholas Yan (origin/main, origin/HEAD, main)* c651c74 - [Product] Add review queue filter server (#132) - Nicholas Yan* eec07e3 - [Product] Add review queue filter api (#131) - Nicholas Yan
gt log long is quite different from
gt log short and
gt log -- it shows the
git source of truth, i.e. the current
git history, instead of Graphite's view of the world. If you don't understand what this means yet, that's ok! We'll get into it later on.
gt log long is just an alias for
git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' --branches, but we prefer the former.
Options for "log" and "log short"
log short both support the following options. Since
log long is just a shortcut for a git command it doesn't have any customizability in Graphite at the moment.
gt log --stack — only 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 --stack but only shows n levels of descendants and ancestors.
gt log --reverse — displays the log with trunk (e.g. main) at the top instead of the bottom. Useful when you have larger stacks to keep their tips near the bottom of the output.
Other details about your branches
Once you've submitted your branches with Graphite (we'll get to this later!),
gt log also includes a link to the PR page and some details about its status.
You can also view some information for one branch at a time with
gt branch info which by default shows, in addition to the PR info, the children and parents of the branch as well as the commit 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.
Now that you know how to visualize your stack, you can use Graphite to navigate it and submit your PRs!