Next: , Previous: , Up: Miscellaneous   [Contents][Index]


8.8 Minor Mode for Buffers Visiting Files

The magit-file-mode enables certain Magit features in file-visiting buffers belonging to a Git repository. It should be enabled globally using global-magit-file-mode. Currently this mode only establishes a few key bindings, but this might be extended in the future.

User Option: magit-file-mode

Whether to establish certain Magit key bindings in all file-visiting buffers belonging to a Git repository. This establishes the bindings suggested in Getting Started (but only for file-visiting buffers), and additionally binds C-c M-g to magit-file-popup.

C-c M-g     (magit-file-popup)

This prefix command shows a popup buffer featuring suffix commands that operate on the file being visited in the current buffer.

C-c M-g s     (magit-stage-file)

Stage all changes to the file being visited in the current buffer.

C-c M-g u     (magit-unstage-file)

Unstage all changes to the file being visited in the current buffer.

C-c M-g c     (magit-commit-popup)

This prefix command shows suffix commands along with the appropriate infix arguments in a popup buffer. See Initiating a Commit.

C-c M-g D     (magit-diff-buffer-file-popup)

This prefix command shows the same suffix commands and infix arguments in a popup buffer as magit-diff-popup. But this variant has to be called from a file-visiting buffer and the visited file is automatically used in the popup to limit the diff to that file.

C-c M-g d     (magit-diff-buffer-file)

This command shows the diff for the file of blob that the current buffer visits.

User Option: magit-diff-buffer-file-locked

This option controls whether magit-diff-buffer-file uses a dedicated buffer. See Modes and Buffers.

C-c M-g L     (magit-log-buffer-file-popup)

This prefix command shows the same suffix commands and infix arguments in a popup buffer as magit-log-popup. But this variant has to be called from a file-visiting buffer and the visited file is automatically used in the popup to limit the log to that file.

C-c M-g l     (magit-log-buffer-file)

This command shows the log for the file of blob that the current buffer visits. Renames are followed when a prefix argument is used or when --follow is part of magit-log-arguments. When the region is active, the log is restricted to the selected line range.

C-c M-g t     (magit-log-trace-definition)

This command shows the log for the definition at point.

User Option: magit-log-buffer-file-locked

This option controls whether magit-log-buffer-file uses a dedicated buffer. See Modes and Buffers.

C-c M-g B     (magit-blame-popup)

This prefix command shows all blaming suffix command along with the appropriate infix arguments in a popup buffer. See Blaming.

C-c M-g b     (magit-blame)

This command shows for each line the revision in which it was added.

C-c M-g r     (magit-blame-removal)

This command shows for each line the revision in which it was removed. This command is only available in blob-visiting buffers.

C-c M-g f     (magit-blame-reverse)

This command shows for each line the last revision in which it still exists. This command is only available in blob-visiting buffers.

C-c M-g e     (magit-edit-line-commit)

This command makes the commit editable that added the current line.

With a prefix argument it makes the commit editable that removes the line, if any. The commit is determined using git blame and made editable using git rebase --interactive if it is reachable from HEAD, or by checking out the commit (or a branch that points at it) otherwise.

C-c M-g p     (magit-blob-previous)

Visit the previous blob which modified the current file.


Next: , Previous: , Up: Miscellaneous   [Contents][Index]