Prompting for Repository in Magit Status

I found another great tip from Leonardo Etcheverry. Sometimes I want to call magit-status but the current buffer isn’t associated with the proper repository. That happens, for example, when I’m in the agenda buffer and want to commit one of the associated files that just got updated by Org. Usually, I just switch to a buffer with a file associated with the desired repository. That works but it’s a little inconvenient.

It turns out that if you put a list of your repositories in magit-repo-dirs and call magit-status with the universal argument prefix, magit will prompt you for the repository. That’s really convenient; I can’t believe I’m just now learning about it.

Check out Etcheverry’s post for the details on how to set things up. I really love this tip.

This entry was posted in General and tagged , . Bookmark the permalink.

2 Responses to Prompting for Repository in Magit Status

  1. foobar says:

    You do not even need to set up anything and just use `C-u C-u M-x magit-status`

    • jcs jcs says:

      Nice. I didn’t know that. Actually, the situation is a bit more complicated. Here’s part of the documentation for magist-status:

      Interactively, a prefix argument means to ask the user which Git
      repository to use even if `default-directory’ is under Git
      control. Two prefix arguments means to ignore `magit-repo-dirs’
      when asking for user input.

      So the double C-u is handy if you haven’t set up magit-repo-dirs.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>