|Description||Git integration for Emacs|
Magit is an Emacs mode for working with Git repositories. It provides a convenient interface for the most common Git operations.
- 1 Basic setup
- 2 Helpful keybindings
- 3 Common Customization
- 4 Extensions
- 5 See Also
- 6 Project Pages
(add-to-list 'load-path "/path/to/magit/directory") (require 'magit)
- M-x magit-status is the main entry point to Magit. The author recommends binding this command to "a key of your choice". is a common choice:
(global-set-key (kbd "C-x g") 'magit-status)
The official Magit documentation is excellent and should be consulted for further information.
Change magit diff colors
If you want more common colors (green and red), instead of psyche highlighting:
(eval-after-load 'magit '(progn (set-face-foreground 'magit-diff-add "green3") (set-face-foreground 'magit-diff-del "red3") (when (not window-system) (set-face-background 'magit-item-highlight "black"))))
Use ido to checkout branches
(setq magit-completing-read-function 'magit-ido-completing-read)
magit-filenotify: refresh status buffer when git tree changes
This module, to be installed with ELPA, comes with a minor mode magit-filenotify which tracks changes in the source tree using file-notify and refreshes the magit status buffer. Emacs 24.4 with `file-notify-support' is required for it to work.
home and documentation: https://github.com/magit/magit-filenotify
highlight uncommited changes on the gutter area
Git-gutter is an extension to highlight uncommitted changes on the left side of the window, indicating wether a line has been inserted, modified or deleted, and allowing you to jump between and revert them selectively. diff-hl does it too and works with Git, Mercurial, Bazaar and Svn, and it provides similar functionnality for dired. Both are available in ELPA. They are Tramp-aware.
After installation, call the minor modes or enable them:
(add-hook 'python-mode-hook 'git-gutter-mode)
Jump between changes
To jump between changes: M-x git-gutter:next-hunk or M-x diff-hl-next-hunk.