Magit for Emacs

Enjoy this cheat sheet at its fullest within Dash, the macOS documentation browser.

Popups

!

Running git

b

Branching

B

Bisecting

c

Committing

d

Diffing

E

Ediff

f

Fetching

F

Pulling

l

Logging

m

Merging

M

Remoting

P

Pushing

o

Submoduling

r

Rebasing

w

Apply patches

W

Format patches

t

Tagging

z

Stashing

Section Movement

p

Previous section

n

Next section

P

Previous sibling section

N

Next sibling section

^

Parent section

Section Visibility

TAB

Toggle visibility of current section

C-TAB

Cycle visiblity of section and children

S-TAB

Cycle visibility of all sections in buffer

Staging

s

Stage change at point

u

Unstage change at point

S

Stage all changes in worktree

U

Reset index to some commit

M-x magit-unstage-all

Remove all changes

M-x magit-stage-file

Stage current file

M-x magit-unstage-file

Unstage current file

Status/Diff/Log Buffer

SPC

Update commit/diff buffer or scroll up

DEL

Update commit/diff buffer or scroll down

h

Show dispatch popup

g

Refresh

G

Refresh all

q

Bury current buffer

L

Toggle margin

x

Soft reset (hard when argument is given)

y

Show references (tags and branches)

Y

Cherry pick

C-c C-b

Move backward in buffer's history

C-c C-f

Move forward in buffer's history

e

Ediff DWIM

i

Gitignore

I

Gitignore locally

View Git Output

$

Display process buffer for current repository

k

Kill process represented by section at point

References Buffer

y

Compare references with current HEAD

c

Compare references with current branch

o

Compare references with other branch

Diff Buffer

RET

Visit file (or blob) at appropriate position

C-RET

Visit file at appropriate position

-

Decrease context of diff hunks

+

Increase context of diff hunks

0

Reset context of diff hunks to default height

j

Jump to diff stat <-> diff section

Blaming

M-x magit-blame

Display edit history of file

RET

Show the commit at point

SPC

Update commit/diff buffer or scroll up

DEL

Update commit/diff buffer or scroll down

n

Move to the next chunk

N

Move to the next chunk (same commit)

p

Move to the previous chunk

P

Move to the previous chunk (same commit)

q

Turn off magit blame mode

t

Show or hide blame chunk headings

Log Buffer

+

Show more history

C-c C-c

Select commit at point and act on it

C-c C-k

Abort selecting commit

Repository Setup

M-x magit-init

Initialize a Git repository

M-x magit-clone

Clone a repository