Unlike Emacs's native Version Control package which strives to provide a unified interface to various version control systems, Magit only supports Git and can therefor better take advantage of its native features.
Magit supports GNU Emacs 23.2 or later; 24.1 or later is recommended. Magit supports Git 18.104.22.168 or later; 1.8.2 or later is recommended. The minimal versions are those available in ancient Debian oldstable.
- Getting Started
- Getting Help
To get started with Magit, run M-x magit-status. If you
are inside a Git repository this opens a buffer that summarizes its
status. Otherwise you are first prompted for a repository. Read the
short help for
magit-status-mode (C-h m in the status
buffer), make some changes to your files, then stage (s)
and commit (c) them.
For more details consult the Magit user manual. You can read it on the web or in Emacs with C-u C-h i magit.info.
Magit also has a website.
Emacs >=24.1 includes a facility that lets you easily download and
install packages. Using
package.el is the easiest and recommended
way to install Magit and its dependencies.
The stable Magit version is available from the Marmalade
package repository. If you want to install the development version
master branch) use the Melpa repository instead.
Please note that all packages on Melpa are built from the upstream
master branch. If you generally want stable versions but the latest
Magit use Marmalade and install Magit from Git.
package.el to use one of the package repositories:
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t)
For details please see the website of the package repository of your choosing.
Then install Magit (and its run-time dependencies):
M-x package-install RET magit RET
If you want to contribute to Magit you should run it directly from the git repository.
First get the repository:
$ git clone git://github.com/magit/magit.git
You then have the choice between the
next (experimental) branches. Unless you have
master you need to create and checkout the branch.
$ git checkout -b LOCAL-BRANCH REMOTE-BRANCH
Then you should byte compile the libraries and generate the documentation, though that is not required.
$ make lisp docs
You can also do so manually.
$ emacs -Q --batch -L . [-L ../path/to/cl-lib] -f batch-byte-compile *.el $ makeinfo -o magit.info magit.texi $ install-info --dir=dir magit.info
Then add this to you init file:
(add-to-list 'load-path "/path/to/magit") (require 'magit)
And optionally tell
info about the documentation:
(eval-after-load 'info '(progn (info-initialize) (add-to-list 'Info-directory-list "/path/to/magit/")))
For a list of all make targets see:
$ make help
Please consider using
package.el instead. Still here? Download and
unpack magit-1.3.0.tar.gz. Then build and install as usual:
$ wget https://github.com/downloads/magit/magit/magit-1.3.0.tar.gz $ tar -xf magit-1.3.0.tar.gz $ cd magit-1.3.0 $ make $ sudo make install
This installs the Emacs lisp libraries, as well as the prebuilt documentation from the tarball. You may alternatively build the documentation yourself:
$ make docs $ sudo make install-docs
magit shell script can be installed using:
$ sudo make install-script
For a list of all make targets see:
$ make help
By default the Emacs lisp libraries are installed in
/usr/local/share/emacs/site-lisp/magit/. Unless Emacs itself is
also installed in
/usr/local/ you have to add that directory to the
(add-to-list 'load-path "/usr/local/share/emacs/site-lisp/magit")
magit can be loaded:
Add the above lines to your init file (
~/.emacs.d/init.el) and restart Emacs.
If you install Magit using
package.el then dependencies are
automatically being taken care of. Otherwise you have to track down
dependencies and install them manually.
cl-libis a new library in Emacs 24.3. Like the old
clit provides various Common Lisp forms, but differs in that symbols are prefixed with
cl-. A forward compatibility
cl-libfor older versions of Emacs is available from the GNU Elpa repository. You can install it using
package.elor get it here.
git-commit-modewhich is part of the git-modes repository and available as a separate package from Melpa.
git-rebase-modewhich is part of the git-modes repository and available as a separate package from Melpa.
The following libraries build on third-party tools or git subcommands that are not installed by the Git base-package on some distributions:
magit-svn.elrequires the official Git subcommand
To run tests the following libraries are also required:
ertis a tool for automated testing. It is part of Emacs starting with version 24.1. You can also obtain an old version from the former development repository.
Magit's canonical source repository is hosted on Github.