Git is supported by
vc-git since 22.1, accessible via VersionControl.
vc-git is reported to work well. There are two front end wrapper packages that can be used with
git-blame.el(a frontend to the git-blame command line tool) which are distributed in the Git source distribution in the contrib/emacs directory (already installed in Debian as part of
git-core, or more recently in the separate
git-elpackage). The README file supplied in
contrib/emacsexplains how to install them. Some introductory tutorial material located at Up and Running with Emacs and Git
The command showing the repository status
‘C-x v d’ supports checking in multiple files/directories at a time, and it has fancy display. It can be extended with git specific functions. vc-git-grep can be used as a UI for git grep. vc-git.el also includes support for git blame, in the vc-annotate command
‘C-x v g’.
Magit is the most popular interface to git. If you are new to git and do not need support for other vcs this is likely the package you should try first.
Egg (Emacs got Git; compared to Magit, works in Windows) was forked from Magit and has developed independently since 2008 (Homepage, Documentation, Blog including screenshots), stable and bleeding-edge project pages). Egg has built-in blame-mode that can relocate the blamed commit back into the DAG view (log-buffer.) Normally unreachable commits in the reflogs can also be brought back into the DAG view, making refs recovery error-proof. Egg supports interactive rebase by marking directly on commits (to be picked, edited or squashed) in the DAG view. Egg also has extensive support for pickaxing (only showing the diffs with the search term, highlighting the search term, etc.) The default colours are terrible but can all be customized.
git clone git://github.com/byplayer/egg.git
git-gutter-plus supports reverting, staging, and committing Git hunks straight from the buffer. (Homepage)
DVC is a generic Emacs interface to DistributedVersionControl systems, including git.
egit is an Emacs Git history interface intended to be similar to qgit or gitk (Homepage). Requires git.el.
git clone git://github.com/jimhourihan/egit.git
git clone git://github.com/tsgates/git-emacs.git
git clone git://github.com/mbunkus/mo-git-blame.git
Gitsum is a mode to do interactive partial commits with Emacs in the style of
GitDwim defines context-aware commands.
GitCommitMode helps with editing and manipulating commit messages.
If you are using the Debian git packages, you can add the following to your
.emacs to make all of these available (if you are not using the Debian packages, adjust the path to suit):
Note: This does not work in Emacs 23.0 - git is included.
(setq load-path (cons (expand-file-name "/usr/share/doc/git-core/contrib/emacs") load-path)) (require 'vc-git) (when (featurep 'vc-git) (add-to-list 'vc-handled-backends 'git)) (require 'git) (autoload 'git-blame-mode "git-blame" "Minor mode for incremental blame for Git." t)
git.el will look into your git configuration for committer name and email address. If that fails, it uses the Emacs defaults. If you rely on environment variables for your configuration, beware. (And consider
See snarfed.org/emacs-vc-git-tweaks for elisp that adds direct `git add` and `git reset` support.
Question: I would like to do everything from within Emacs (without having to resort to the command-line). I was able to create a new repository with
‘vc-create-repo’, but don’t know how to add all the files in the directory with
‘vc-next-action’ – something akin to (eventually calling the backend command)
git add . – without having to add each file separately. Any tips?
Older answer: With vc-git.el 2007-11-29 or later, you can do
‘C-x v d’to see the (empty) directory; then
‘v t’to toggle visibility of “modified” files; then
‘m’to mark files to add; and finally
‘v v’to do the next action (i.e, commit)
NOTE: This does not seem to work with remote repos (vc-git.el 2010-03-09).
Question: How do I revert an uptodate file to a previous version? How do I manage branches?
: Sorry, but it is absolutely unclear what vc-git.el (coming with emacs23) provides. Neither Info nor vc-git.el give any information about what works with remote repositories and how (cloning, staging, registering, commiting, …). What is stash? What is the master-file? Why does vc-dir not show the remote-url?