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.
  • foobar

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

    • jcs

      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.