mislav / gh-branch

GitHub CLI extension for fuzzy finding, quickly switching between and deleting branches.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is it possible to list remote branches as well?

tnorthcutt opened this issue · comments

Thanks for this extension! I've already found it very useful.

I'm curious: would it be possible to modify this to also include remote branches? I would be more than happy to work on adding that, but I'm honestly not entirely sure where to start.

It's definitely possible, but for larger project maybe the full list of remote branches would be too much?

Anyway here is where the list of branches is fetched

git for-each-ref 'refs/heads/**' --format='%(refname:short)%09%(committerdate:unix)%09%(committerdate:relative)%09%(HEAD)'

You could easily include other refs just by changing the refspec to refs/remotes/origin/** I think.

@mislav Thank you for the fast reply!

Looks like if I do that, then the PR matching doesn't work. I'll poke at it a bit more... I'm not so great with bash scripting but maybe I can figure something out 😅

I got this working on my fork. Let me know if you'd like a PR.