I am working through some tutorials for git and don’t understand the difference between running
git rm [path/to/file]
and
git rm -r [path/to/file]
What exactly does the recursive mean?
Thanks in advance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
From the git-rm man page:
A leading directory name (e.g.
dirto removedir/file1anddir/file2) can be given to remove all files in the directory, and recursively all sub-directories, but this requires the-roption to be explicitly given.Thus
git rm -r /path/to/filedoes the same asgit rm /path/to/fileand stages the file for removal. Howevergit rm -r /path/to/directoryremoves the directory and recursively everything it contains.