Emacs, scripting and anything text oriented.

How to undo the unpushed commits in magit?

Kaushal Modi

In Magit buffer *magit: ..*,

  • Hit x
  • Select origin/master

Above action will undo all the commits that haven’t been pushed to origin/master. It will still preserve the modified states of the yet-to-be staged/committed files.