What’s the easiest way from the command line to de...
# how-do-i
t
What’s the easiest way from the command line to determine if two branches are in the same stack?
✅ 1
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
I think just
gt ls
?
t
image.png
I want something that can return true/false in a script
p
ah 😓 I'll log as a feature request
t
Perhaps there’s something clever I could do with commit hashes?
p
Oh, you can use
gt ls -s
to filter it to only the current stack
❤️ 1
t
Oh, that’s perfect. That’s even easier. I can just search for the branch names in the output of that.
😌 1
It would be nice to be able to pass a branch name to that though
👀 1
I ended up going with
git branch --contains "$(git rev-list "develop..$target" | tail -1)" --format='%(refname:short)'
instead, since it’s just one command rather than having to do
gt ls -s
per worktree. But if that fails due to detached head, I’m going to have the script fall back to
gt ls -s