1

Due to my workflow I have a lot of branches that I don't want to see in the magit helm checkout window. Is there a way to hide some branches here, preferably with a regexp?

3
  • 1
    On the Magit end, there isn't a user option for something like this. You don't give the details of your workflow, but if the branches of interest tend to be the most recently modified ones, using (setq magit-list-refs-sortby "-creatordate") could help.
    – Kyle Meyer
    May 31, 2017 at 1:08
  • Does this satisfy your needs?
    – tarsius
    Jun 5, 2017 at 17:17
  • No, I need filtering by regexp.
    – Milan
    Jun 5, 2017 at 18:44

1 Answer 1

1

Magit does not support this currently. You should open a feature request. I probably won't implement this any time soon, but an issue would help me to not forget about this completely.

Edit: I am longer considering to implement this. My recommendation is to set remote.<name>.fetch so that the boring branches don't even make it into your local repository.


You can however abuse another feature that I just added for this purpose:

(advice-add 'magit-list-branch-names :around
            #'magit-list-branch-names:filter)

(defun magit-list-branch-names:filter (fn)
  (-filter #'magit-refs-insert-refname-p (funcall fn)))

You will have to advice other magit-list-* functions the same way for all commands to be affected. And obviously you have to customize magit-refs-filter-alist.


Another option could be to use a completion framework (such as ivy) that let you easily deal with many completion candidates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.