Teaching Magit new tricks

If you’re using Magit 1.0 or newer to work with Git from Emacs, you have probably noticed that when you press keys it now shows a little menu where you can enable flags and pass options. It’s easy to add more. Here’s how I teach Magit about “push -u”, which I use to push local branches to a remote repository and configure them to track the remote branch automatically:

(eval-after-load 'magit
  '(magit-key-mode-insert-switch 'pushing "-u" "Set upstream" "-u"))

You can find all the groups of switches and arguments by typing C-h v magit-key-mode-groups

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> <pre lang="" line="" escaped="">