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.el in master branch:
(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)
"Submap for jumping to sections in `magit-status-mode'.")
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
- Stage the files you want using
- 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
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