Is there a way to get the parent of a given branch...
# how-do-i
z
Is there a way to get the parent of a given branch? Like
gt parent <some other branchname>
? Would really be useful to me I know
gt parent
gives the parent of the current branch, which is useful, but not what I'm asking for here
p
(If applicable) To help us more clearly understand what you're trying to do, please provide additional details about: - Screenshots / debug logs / list of commands you've tried to run so far - Your workflow - Current state
Hey Zach, i dont think this is possible today. Curious to hear your use case so i can best capture this as an enhancement request.
z
I heavily use fzf, I have a bunch of git checkout workflows that use fzf, and for graphite I want the preview to show inter-PR modified files I'll send a little screencap
Screen Recording 2025-10-29 at 3.49.44 PM.mov
So I have this
gtls
command to basically do
gt ls
and let me select a branch in the stack with fzf, and when I select it with "enter", it checks out that branch (I've been using a command like this with regular git for many years)
I love the command
git diff --name-only $(gt parent)..HEAD
just to show which files differ from a branch to the parent
I want the preview window at the top of my command to show that: the files that changed between the parent and the upstack branch I'm selecting (so I can see "ah this is the PR where I changed x.js")
Pretty normal thing
I think it's weird that this isn't already supported tbh!
There are currently two options: •
gt info
and some bash scripting to extract the parent (appears in the output as
Parent: <branch>
- can use sed/awk etc. •
gt ls
and some bash scripting to find the parent (the one on the line after the line with the specified branch)
I think this is fine:
Copy code
get_graphite_parent(){
    local specified_branch="$1"
    gt info --branch=$specified_branch --stat=true | grep "Parent:" | awk '{print $2}'
}
Most unix utils do exactly one thing and do it well and composably. I've noticed that most of the core graphite commands are not this way. They could certainly be built up from atomic pieces (like
get_graphite_parent <branch name>
would be), and maybe their implementations are, but those atomic pieces are not exposed to the user interface. I want to be good at using graphite and I'm finding it much more difficult than being good at other dev tools.
Look at this output from `gt info`:
Copy code
branch-name-placeholder
38 minutes ago

PR #3299 (Draft) PR name from Graphite webapp
<https://app.graphite.dev/github/pr/><org>/<repo>/3299
Last submitted version: v31

Parent: parent-branch-name-placeholder
Children:

commit <commit hash>
Author: Zach Siegel <zsiegel@mycompany.com>
Date:   Wed Oct 29 10:08:09 2025 -0400

    ...a commit message from gt modify -cm 'messag'...
    ...a commit message from gt modify -cm 'messag'...
    ...a commit message from gt modify -cm 'messag'...

commit <commit hash>
Author: Zach Siegel <zsiegel@mycompany.com>
I think it's unlikely anyone will need this exact collection of random useful things frequently. If they need "all the info" they'll use the webapp; if they need something fine-grained (like git log or branch name) they'll use git directly. I don't think this command has good UX at all