How do I show branches only inside one branch folder or subfolder?

2.4k Views Asked by At

I have organized my branches into folders and subfolders. I am only accessing my GIT repo through the CLI. I would like to be able to list only branches inside a branch folder.

FEATURE/branch-1
FEATURE/branch-2
FEATURE/CURRENT/branch-000
FEATURE/CURRENT/branch-001
FEATURE/CURRENT/branch-002
* master
dev
v2.0.0/branch-3
v2.1.0/branch-4
v2.1.0/branch-5

> git branch shows me everything, however I would like to only see the v2.1.0 folder. Is there a command that can output only the v2.1.0 branch folder from my example above?

Also, as a bonus, is there a way to get a branch subfolder FEATURE/CURRENT/**?

3

There are 3 best solutions below

3
On BEST ANSWER

git branch --list *v2.1.0* will show all branches with v2.1.0 in their branch name

3
On

Probably git show branch is what you're looking for. You can use globs and everything.

For instance, if you've got master, b/one and b/two

git show-branch b/*

will show

! [b/one] Some changes
 ! [b/two] changed to kk2
--
 + [b/two] changed to kk2
++ [b/one] Some changes

There's a bit of stuff (like the last commit) besides the branch name, but that will only list the branches you are looking for.

0
On

Try this one:

git branch -a --list v2.1.0/*

I think it will solve your problem