mhutchie / vscode-git-graph

View a Git Graph of your repository in Visual Studio Code, and easily perform Git actions from the graph.
https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
Other
1.97k stars 260 forks source link

Regex branch filtering #595

Open Awbmilne opened 2 years ago

Awbmilne commented 2 years ago

Describe the feature that you'd like Regex based branch filtering, and maintain branch selection between Git Graph closes

Additional context (optional) For corporate repositories with hundreds of branches based features/buxfixes, it is difficult to select a list of branches to view. One nice solution could be to allow regex based branch filtering (in branch search or another field). This would allow looking for keywords or a ticket/issue number in the branch name.

This would only really be useful if the regex was kept when you closed/reopened Git Graph. Not sure how practical a change like that is, but would sure help me out!

Thanks for the great work with this extensions! Saves me so much time and headache!

Awbmilne commented 2 years ago

WOW! This already sorta exists! Using glob!

For those hunting

Use the git-graph.customBranchGlobPatterns setting, like so:

"git-graph.customBranchGlobPatterns": [
        {
            "name": "My Branch Filter",
            "glob": "heads/*keyword*"
        },
        {
            "name": "My Other Branch Filter",
            "glob": "heads/feature/*"
        },
        {
            "name": "My Another Filter",
            "glob": "heads/<Jira Tag>:*"
        }
    ],

While its not as good as full Regex, and not GUI accessible, it is extremely useful!

I feel like a Regex version/expansion could useful, and an easier way to use it from the GUI, so that this functionality can be used on a daily bases without needed to play with the setting.json.

shaofeng66 commented 1 year ago

@Awbmilne do you know by glob how to filter remote branch only? I want show only "origin/release-*" branches. Thank you!

shaofeng66 commented 1 year ago

@Awbmilne do you know by glob how to filter remote branch only? I want show only "origin/release-*" branches. Thank you!

Answering my own question:


        {
            "name": "remote release branches",
            "glob": "remotes/origin/release-*"
        },