I’ve been an Emacs user off and on for something like 25 years. I started using it when I was programming Common Lisp as a university research assistant but stopped for a number of years during my sojourn into Windows-land. When our team decided to build the next generation of our product on Linux back in 2001, we looked around for a usable C++ IDE and couldn’t find one. So we decided to run with Emacs and have been using it regularly ever since.

I still switch tools quite a bit. Smalltalk has its own environment to work in, and I tend to prefer RubyMine for substantial Ruby work. But for simple Ruby stuff (Rakefiles and such), C++, and other miscellaneous editing, I use Emacs.

When we decided to migrate to Git a few years ago, I decided to try Magit in Emacs as a front-end, and I’ve never looked back. Magit is a very nice way of interacting with Git repos, and it works right in my main editor.

Before continuing, I should mention that I have never really used Emacs’ built-in version control support. It is possible that it does a lot of what Magit does already.

I won’t go through an exhaustive list of features, but I’ll mention a few of the ones that I find particularly handy.

I define a keyboard shortcut for running the magit-status command (C-c m). That opens a new buffer showing me the status of the current repository. From there, I can add (“stage”) files, look at diffs, and commit and revert changes, etc. I can also branch, fetch, pull, push, merge, stash, and even start an interactive rebase using simple keyboard shortcuts.

I can ignore files, optionally specifying a more general pattern for the ignore. This feature adds the new entry to my .gitignore for me.

Many of the commands use an interesting built-in menu system to allow customization of options before performing operations. For example, to commit a set of changes, I hit c and I am shown a list of switches and arguments I can specify as well as a number of actions to perform. For example, I can use c to commit normally, a to amend my previous commit, etc. Similar menus are used for pull, push, branch, fetch, merge, and stash.

A more subtle feature of Magit is its support for partial commits (such as you might do with git add -p). In the Magit status buffer, you can hit TAB on a file to expand the diff. You can then navigate the chunks of the diff individually, using + and - to make the sections larger or smaller. Once you have isolated a chunk of interest, you can hit s to stage just that chunk, leaving the rest unstaged for a future commit. If that isn’t fine-grained enough, you can just select the portion of the diff you want and stage just that portion.

Overall, I find Magit to be a very powerful front-end to Git, and I use it all the time. Highly recommended.