0

Q: how can I get magit + ido to ignore tags when checking out a branch?

I'm using magit + ido. When I go to check out a branch, ido helpfully gives me the names of all existing branches, but it also gives me the names of all tags. Sometimes I want that, but usually I don't.

How can I convince magit + ido not to offer tags as a completion option?

1

You can control how refs are sorted with magit-list-refs-sortby, but Magit doesn't have a built-in option for excluding tags from the candidates listed by magit-checkout.

One way you could get this behavior is by overriding magit-checkout's interactive form, temporarily removing "refs/tags" from magit-list-refs-namespaces.

(advice-add
 'magit-checkout :around
 (lambda (f revision)
   (interactive
    (list (let ((magit-list-refs-namespaces
                 (remove "refs/tags" magit-list-refs-namespaces)))
            (magit-read-other-branch-or-commit "Checkout"))))
   (funcall f revision))
 '((name . "magit-checkout-notags")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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