This is a very basic but I have been unable to find the answer on the web. Is it possible to git rm, i.e. to remove a tracked file, from magit?


  • The question has been asked and answered on superuser: superuser.com/questions/516639/….
    – Rémi
    Jun 19 '16 at 13:03
  • There is also magit-do-async-shell-command, which I have bound to "&" in a magit-status buffer.
    – harvlittle
    Nov 22 '19 at 10:06

Magit does not provide a command that does git rm (but if you opened a feature request, then I would probably add it eventually).

Meanwhile you can delete the file using some other method, e.g. using M-x delete-file RET <file> RET. Once you have done that refresh the Magit buffer using g and then stage the "deletion" of the file by moving to it in the list of unstaged changes and then pressing s.


Magit doesn't support git rm. Instead, delete the folder in dired, and then stage the change.

You can also use ! to launch any git command.

  • 33
    K (magit-file-untrack) does git rm --cached
    – npostavs
    Jun 19 '16 at 13:41
  • 2
    This 'K' key is very usefull. Thanks.
    – wizmer
    Jun 21 '16 at 1:34
  • @npostavs Why isn't your comment the accepted answer?
    – Daniel
    Jan 11 '19 at 8:39
  • @Daniel It's an answer for a different question.
    – npostavs
    Jan 11 '19 at 13:38
  • 2
    @npostavs Thanks for the comment. I see, so git rm --cached does not remove the file from disk, whereas git rm does. Thanks!
    – Daniel
    Jan 11 '19 at 15:45

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.