首页 > 解决方案 > Limit remote branch decorations but keep HEAD decoration

问题描述

I would like to decorate my git log with all local branches and a small number of remote branches whose names I know, while ignoring all other remote branches.

The remote branches I want to decorate follow a bit of a naming pattern (they all start with a certain prefix like develop/), and I initially used

git log --decorate-refs=heads --decorate-refs=remotes/origin/develop/*

Which worked, but git log would no longer decorate HEAD. Is there a way to explicitly tell git log to decorate HEAD?

Next, I tried to come up with a exclusion rule solution using glob patterns, but this is the best I could get to work:

git log --decorate-refs-exclude="remotes/origin/[!d]*"

Now HEAD is decorated, but the rule only excludes remote branches that do not start with d. I was unable to make a glob pattern that would exclude all remote branches that don't start with develop/. Is this possible, without excluding HEAD?

标签: git

解决方案


推荐阅读