Use the "!" prefix to ignore tags of the given pattern. This has precedence over other matching patterns. For example, $ git tag -l \!*-rc? v1.7.8* v1.7.8 v1.7.8.1 v1.7.8.2 v1.7.8.3 v1.7.8.4 $ git tag -l v1.7.8* \!*-rc? v1.7.8 v1.7.8.1 v1.7.8.2 v1.7.8.3 v1.7.8.4 This is equivalent to, $ git tag -l v1.7.8* | grep -v '\-rc.' v1.7.8 v1.7.8.1 v1.7.8.2 v1.7.8.3 v1.7.8.4 Signed-off-by: Tom Grennan <tmgrennan@xxxxxxxxx> --- builtin/tag.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/builtin/tag.c b/builtin/tag.c index 31f02e8..b9ef718 100644 --- a/builtin/tag.c +++ b/builtin/tag.c @@ -32,13 +32,18 @@ struct tag_filter { static int match_pattern(const char **patterns, const char *ref) { + int ret; + /* no pattern means match everything */ if (!*patterns) return 1; - for (; *patterns; patterns++) - if (!fnmatch(*patterns, ref, 0)) - return 1; - return 0; + for (ret = 0; *patterns; patterns++) + if (**patterns == '!') { + if (!fnmatch(*patterns+1, ref, 0)) + return 0; + } else if (!fnmatch(*patterns, ref, 0)) + ret = 1; + return ret; } static int in_commit_list(const struct commit_list *want, struct commit *c) -- 1.7.8 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html