Difference between revisions of "Magit"

From WikEmacs
Jump to: navigation, search
(See Also)
(Change magit diff colors)
 
(11 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
|name=Magit
 
|name=Magit
 
|description=Git integration for Emacs
 
|description=Git integration for Emacs
|author=Phil Jackson
+
|author=Marius Vollmer
|maintainer=Phil Jackson
+
|maintainer=Jonas Bernoulli
 
|source=https://github.com/magit/magit
 
|source=https://github.com/magit/magit
 
}}
 
}}
Line 11: Line 11:
 
== Basic setup ==
 
== Basic setup ==
  
 +
Install Magit from MELPA:
 +
 +
    package-install RET magit RET
 +
 +
And require it in your dotfile:
 
<source lang="lisp">
 
<source lang="lisp">
(add-to-list 'load-path "/path/to/magit/directory")
 
 
(require 'magit)
 
(require 'magit)
 
</source>
 
</source>
Line 21: Line 25:
 
{{Snippet|(global-set-key (kbd "C-x g") 'magit-status)}}
 
{{Snippet|(global-set-key (kbd "C-x g") 'magit-status)}}
  
The [http://magit.github.com/magit/magit.html official Magit documentation] is excellent and should be consulted for further information.
+
The [https://github.com/magit/magit official Magit documentation] is excellent and should be consulted for further information.
  
 
== Common Customization ==
 
== Common Customization ==
 +
 +
=== Change magit diff colors ===
 +
 +
If you want more common colors (green and red), instead of psyche highlighting:
 +
 +
The following way seems not working with recent Magit.
 +
<source lang="lisp">
 +
(eval-after-load 'magit
 +
'(progn
 +
    (set-face-foreground 'magit-diff-add "green3")
 +
    (set-face-foreground 'magit-diff-del "red3")
 +
    (unless window-system
 +
      (set-face-background 'magit-item-highlight "black"))))
 +
</source>
 +
 +
Try this with recent Magit.
 +
<source lang="lisp">
 +
(custom-set-faces
 +
  ;; custom-set-faces was added by Custom.
 +
  ;; If you edit it by hand, you could mess it up, so be careful.
 +
  ;; Your init file should contain only one such instance.
 +
  ;; If there is more than one, they won't work right.
 +
  '(magit-diff-added ((t (:background "black" :foreground "green3"))))
 +
  '(magit-diff-removed ((t (:background "black" :foreground "red3")))))
 +
</source>
 +
 +
=== Use ido to checkout branches ===
 +
 +
(setq magit-completing-read-function 'magit-ido-completing-read)
 +
 +
== Extensions ==
 +
 +
=== 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
 +
  
 
== See Also ==
 
== See Also ==
Line 29: Line 74:
 
* [[Version Control]]
 
* [[Version Control]]
 
* [[Git]]
 
* [[Git]]
* [[MagitHub]]
 
  
 
== Project Pages ==
 
== Project Pages ==

Latest revision as of 06:24, 29 May 2016

Magit
Description Git integration for Emacs
Author Marius Vollmer
Maintainer Jonas Bernoulli
Source https://github.com/magit/magit

Magit is an Emacs mode for working with Git repositories. It provides a convenient interface for the most common Git operations.

Basic setup

Install Magit from MELPA:

   package-install RET magit RET

And require it in your dotfile:

(require 'magit)

Helpful keybindings

  • M-x magit-status is the main entry point to Magit. The author recommends binding this command to "a key of your choice". [C-x g] 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.

Common Customization

Change magit diff colors

If you want more common colors (green and red), instead of psyche highlighting:

The following way seems not working with recent Magit.

(eval-after-load 'magit
 '(progn
     (set-face-foreground 'magit-diff-add "green3")
     (set-face-foreground 'magit-diff-del "red3")
     (unless window-system
       (set-face-background 'magit-item-highlight "black"))))

Try this with recent Magit.

(custom-set-faces
   ;; custom-set-faces was added by Custom.
   ;; If you edit it by hand, you could mess it up, so be careful.
   ;; Your init file should contain only one such instance.
   ;; If there is more than one, they won't work right.
   '(magit-diff-added ((t (:background "black" :foreground "green3"))))
   '(magit-diff-removed ((t (:background "black" :foreground "red3")))))

Use ido to checkout branches

(setq magit-completing-read-function 'magit-ido-completing-read)

Extensions

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


See Also

Project Pages