I have a tracked file in a git repository. How do I untrack this file without deleting it using magit?
i will gitignore the file and untrack it from the git repository.
Behind the scenes, it does
git rm --cached - More info about this git command from a StackOverflow question
M-x magit-file-untrack from a buffer visiting a tracked file or from a Magit buffer. When the buffer visits a file then that file is offered as default choice.
When point is on a file in a Magit buffer, then that is also offered as default. You might also want to add the new
magit-status-sections-hook, then a tree of all tracked files is inserted into the status buffer (but doing so might not be good for performance in big repositories).
In the Magit buffer, hit K (uppercase k) on the file. It works with magit 2.3; I don't know for earlier versions.