Branch Specification Wildcard Syntax (Git)


What syntax is available to me to be able to filter the branches in the Branch Specification?

My branches are mostly named like....


...but there are some like...


I want to include the branches like the first example, but the not the ones like the second, but with only one '*' wildcard allowed I don't seem to be able to do that. e.g.

+:refs/heads/main-feature* kind of ok as a start, but I then want to further exclude branches with the second '-', something along the lines of...


...but that doesn't seem to be possible because I can only use one '*' wildcard.


Hi Gavin,

Will the following setup work for you:


If not, please provide an example.


Ah, sorry, my example was not so clear.  There are many feature branches which I want to include, but the names follow a pattern e.g.



So I would have hoped to pick them up with the wildcard,  But sometimes there are further branches which I want to exclude...













Hello Gavin,

Thank you for provided examples. Wildcards are also used to extracts the branch name to be displayed in the TeamCity interface (logical branch name) and several wildcard or more complex regexps are not supported.

I would suggest you to change branch naming or try to use separate build configurations. Another option is to check branch in the first build step and finish build if needed, but it's not recommended approach.


Thanks Alina. 


For the moment we have chosen to add '-CI' suffix to the branches we want to be picked up by TeamCity.  We can then use a selector like...


Not totally happy with it, but it means we can choose what to include by just adding that suffix to the file name.


Is there any technical reason why multiple wildcards are not supported?  I notice the source of the git plugin is available online.  Is there any reason I couldn't fork that and extend the filter syntax?



Hello Gavin,

I do not think that there are any technical reasons, the only thing that should be kept in mind is that part matched by * becomes name of the branch.

Just yesterday the same feature was requested in our tracker:, please watch/vote for it.


Please sign in to leave a comment.