11 | Deleting Files in Git |
Files and directories sometimes outlive their usefulness. You can
remove them from your working tree and tell Git to quit tracking
them using the git rm
command.
This doesnât remove the file from your repositoryâs history; it removes it only from your working tree going forward. You can always go back in the history of the repository and see the files or directories that have been removed.
You call git rm
and provide it with a
filename to tell Git to remove it (or a standard shell
patternâ*.php
matches all files that end in
.php
). You donât have to provide the
--
, but itâs necessary if youâre trying to remove a file that conflicts with a command-line option. It tells Git that youâre done providing ...
Get Pragmatic Guide to Git now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.