These commands read any existing Magit buffer that belongs to the current repository from the user and then switch to the selected buffer (without refreshing it).
The last variant uses
magit-display-buffer to do so and thus
These are some of the commands that can be used in all buffers whose
major-modes derive from
magit-mode. There are other common commands
beside the ones below, but these didn’t fit well anywhere else.
This command saves the value of the current section to the
kill-ring, and, provided that the current section is a commit,
branch, or tag section, it also pushes the (referenced) revision to
When the current section is a branch or a tag, and a prefix argument
is used, then it saves the revision at its tip to the
instead of the reference name.
When the region is active, this command saves that to the
kill-ring-save would, instead of behaving as
described above. If a prefix argument is used and the region is
within a hunk, then it strips the diff marker column and keeps
only either the added or removed lines, depending on the sign of
the prefix argument.
This command saves the revision being displayed in the current buffer
kill-ring and also pushes it to the
is mainly intended for use in
magit-revision-mode buffers, the only
buffers where it is always unambiguous exactly which revision should
Most other Magit buffers usually show more than one revision, in some way or another, so this command has to select one of them, and that choice might not always be the one you think would have been the best pick.
Outside of Magit
C-w are usually bound to
kill-region, and these commands would also be useful in Magit buffers.
Therefore when the region is active, then both of these commands
kill-ring-save instead of as described above.