4

I have created quite a few stashes and I wanted to drop all of them at once.

From terminal I could have done

git stash clear

I couldn't find a way to do it from magit.

I tried selecting all stashes and drop, but that didn't work.

  • 1
    Magit recently had a major update, make sure you are running version 2.1 or you may see a large disparity between how your magit and other user's magit behaves. – Jordon Biondo Jul 16 '15 at 19:19
  • I had the same problem. I uninstalled the package I had from melpa and suddenly 2.1.0 was available for me to install and it wasn't before. Now everything is working as expected. @ChillarAnand, try to uninstall and install magit – Rafa de Castro Jul 17 '15 at 5:31
4

This assumes that you are using Magit v2.1 or greater, and it very much sounds like you are using an older version. So start by updating Magit.


If you want to drop more than one stash at a time, select all the stashes using the region and press k. It will ask you if you want to "drop N stashes?".

Another way to drop them all is by putting your cursor on the Stashes header and pressing k. (If you want to delete all stashes, then you should use this method, because it is more efficient than the other, which drops each stash individually.)

0

After browsing source code, I just wrote a function and it works fine

(defun magit-stash-clear ()
  "Magit - drop all stashes."
  (interactive)
  (magit-run-git "stash" "clear"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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