45

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?

Thanks

tarsius
  • 25,298
  • 4
  • 69
  • 109
wizmer
  • 877
  • 1
  • 7
  • 9
  • The question has been asked and answered on superuser: http://superuser.com/questions/516639/what-is-an-equivalent-of-git-rm-r-in-the-emacs-magit-package. – 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. – hjon Nov 22 '19 at 10:06

2 Answers2

34

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.

tarsius
  • 25,298
  • 4
  • 69
  • 109
22

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.

tarsius
  • 25,298
  • 4
  • 69
  • 109
Rémi
  • 1,607
  • 11
  • 13