I use git-gutter to keep track of git changes in my buffer while editing.

I created this hydra to speed up commits a bit more (when I don't feel like using magit - often because this "takes me away" from my current file).

(defhydra my-git-changes-hydra ()
  "Navigate and record git changes"
  ("j" git-gutter:next-hunk "next")
  ("k" git-gutter:previous-hunk "prev")
  ("s" git-gutter:stage-hunk "stage")
  ("v" git-gutter:popup-hunk "view")
  ("x" git-gutter:revert-hunk "revert"))

This worked pretty well. But it's slightly annoying having to type "yes" and "no" whenever I stage stuff. I'm aware that this there for safety... but if I've already gone into a hydra and am moving around commits and am going through a bunch of changes I think I can accept the risk.

Is there a way to disable the "yes/no" prompting... or switching it to a simple y or n keypress.

  • 3
    I haven't installed git-gutter, but could this solve your problem: git-gutter Homepage . git-gutter.el always asks you whether commit/revert or not. If you don't want, please set git-gutter:ask-p to nil. Mar 8, 2023 at 16:13

1 Answer 1


I hope my unskilled code meets your requirements.

(defun my-stage-hunk ()
  (git-gutter:awhen (git-gutter:search-here-diffinfo git-gutter:diffinfos)
    (git-gutter:do-stage-hunk it)
    (message "Staged. %s" (buffer-name))))

(defhydra my-git-changes-hydra ()
  ("s" my-stage-hunk "stage"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.