Skip to main content

4.1 Modes and Buffers

Magit provides several major-modes. For each of these modes there usually exists only one buffer per repository. Separate modes and thus buffers exist for commits, diffs, logs, and some other things.

Besides these special purpose buffers, there also exists an overview buffer, called the status buffer. It’s usually from this buffer that the user invokes Git commands, or creates or visits other buffers.

In this manual we often speak about "Magit buffers". By that we mean buffers whose major-modes derive from magit-mode.

M-x magit-toggle-buffer-lock     (magit-toggle-buffer-lock)

This command locks the current buffer to its value or if the buffer is already locked, then it unlocks it.

Locking a buffer to its value prevents it from being reused to display another value. The name of a locked buffer contains its value, which allows telling it apart from other locked buffers and the unlocked buffer.

Not all Magit buffers can be locked to their values; for example, it wouldn’t make sense to lock a status buffer.

There can only be a single unlocked buffer using a certain major-mode per repository. So when a buffer is being unlocked and another unlocked buffer already exists for that mode and repository, then the former buffer is instead deleted and the latter is displayed in its place.

Switching Buffers:  
Naming Buffers:  
Quitting Windows:  
Automatic Refreshing of Magit Buffers:  
Automatic Saving of File-Visiting Buffers:  
Automatic Reverting of File-Visiting Buffers: