Using Magit

Isaac Bell
2 min readOct 30, 2021

--

This article is intended as a quick and dirty reference for the “Magit” Git interface in Doom Emacs.

For those unfamiliar with Magit itself, here is an expository blog post and an intro guide.

Several of the commands in this article are only available (by default) in Doom Emacs. To see a general reference guide for Magit, see the link below:

General Reference Sheet:

What follows below is a basic set of commands to remember while navigating Magit in Doom Emacs.

Commands At a Glance:

Initialize Git Repository:

M-x magit-init

Navigate to the Magit Window:

SPC-g-g or C-x g

In the Magit Window

Select files or folders to stage, and stage them with the command S.

Unstage files with command u.

Once you’ve staged all files and folders you want, use command Cto create a commit.

Press TABto expand file diffs.

Enter a commit message, then close the commit buffer and save the commit using the Vim command :wqor :x.

To open a file, select the file and press ENTER.

Merging and Squashing

In the Magit Window, use the command M.

The following commands become available:

Close the merge actions buffer using C-g

Remotes

To bring up the Remotes window, press M in the Magit Window.

The following commands become available:

Pushing/Pulling

Push with the command p.

Pull with the command F.

Fetch with the command f.

--

--