6.3.1 Staging from File-Visiting Buffers
Fine-grained un-/staging has to be done from the status or a diff buffer, but it’s also possible to un-/stage all changes made to the file visited in the current buffer right from inside that buffer.
M-x magit-stage-file
(magit-stage-file
)
When invoked inside a file-visiting buffer, then stage all changes to that file. In a Magit buffer, stage the file at point if any. Otherwise prompt for a file to be staged. With a prefix argument always prompt the user for a file, even in a file-visiting buffer or when there is a file section at point.
M-x magit-unstage-file
(magit-unstage-file
)
When invoked inside a file-visiting buffer, then unstage all changes to that file. In a Magit buffer, unstage the file at point if any. Otherwise prompt for a file to be unstaged. With a prefix argument always prompt the user for a file, even in a file-visiting buffer or when there is a file section at point.