YouTip LogoYouTip

Git Rm

# git rm Command [![Image 3: Git Basic Operations](#)Git Basic Operations](#) * * * git rm command is used to delete files. If you simply manually delete files from the working directory, running `git status` will show a prompt under "Changes not staged for commit". There are several forms to delete files with git rm: 1. Remove files from staging area and working directory: git rm The following example removes tutorial.txt file from the staging area and working directory: git rm tutorial.txt If the file was modified and already added to the staging area, you must use the force delete option `-f`. Force remove the modified tutorial.txt file from the staging area and working directory: git rm -f tutorial.txt If you want to remove a file from the staging area but still keep it in the current working directory, in other words, only remove it from the tracking list, use the `--cached` option: git rm --cached The following example removes tutorial.txt file from the staging area: git rm --cached tutorial.txt ### Examples Delete the hello.php file: $ git rm hello.php rm 'hello.php' $ ls README Remove file from staging area but keep it in working directory: $ git rm --cached README rm 'README' $ ls README You can delete recursively
← Git PullGit Commit β†’