These work on the latest version of magit
from Melpa (from master branch) as tested today.
While in the Magit Status window,
C-u j u
- Jump to the unstaged section, expand it and bring that to the top of the buffer
C-u j s
- Jump to the staged section, expand it and bring that to the top of the buffer
Similar action will apply to other C-u j ..
bindings in the magit-section-jump-map
too.
From magit.el
in master branch:
(defvar magit-section-jump-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "z") 'magit-jump-to-stashes)
(define-key map (kbd "n") 'magit-jump-to-untracked)
(define-key map (kbd "u") 'magit-jump-to-unstaged)
(define-key map (kbd "s") 'magit-jump-to-staged)
(define-key map (kbd "f") 'magit-jump-to-unpulled)
(define-key map (kbd "p") 'magit-jump-to-unpushed)
(define-key map (kbd "r") 'magit-jump-to-pending)
map)
"Submap for jumping to sections in `magit-status-mode'.")
Answer
To answer your specific application to review the hunks in unstaged section, do C-u j u
in the Magit Status buffer.
Applies to the magit master branch code; haven't tried out the next branch.
An example workflow using these bindings
M-x magit-status
- Stage the files you want using
s
- Expand the staged files showing the hunk diffs, while also positioning the top of the staged section to the top of the buffer:
C-u j s
- Commit
c c
, opens COMMIT buffer in a split window
- Write log while reviewing staged diffs in other window. If diff exceeds the window height, I use the 'scroll other window commands'.
- Finish commit
C-c C-c
.