1git-rm(1) 2========= 3 4NAME 5---- 6git-rm - Remove files from the working tree and from the index 7 8SYNOPSIS 9-------- 10'git-rm' [-f] [-n] [-v] [--] <file>... 11 12DESCRIPTION 13----------- 14A convenience wrapper for git-update-index --remove. For those coming 15from cvs, git-rm provides an operation similar to "cvs rm" or "cvs 16remove". 17 18 19OPTIONS 20------- 21<file>...:: 22 Files to remove from the index and optionally, from the 23 working tree as well. 24 25-f:: 26 Remove files from the working tree as well as from the index. 27 28-n:: 29 Don't actually remove the file(s), just show if they exist in 30 the index. 31 32-v:: 33 Be verbose. 34 35\--:: 36 This option can be used to separate command-line options from 37 the list of files, (useful when filenames might be mistaken 38 for command-line options). 39 40 41DISCUSSION 42---------- 43 44The list of <file> given to the command is fed to `git-ls-files` 45command to list files that are registered in the index and 46are not ignored/excluded by `$GIT_DIR/info/exclude` file or 47`.gitignore` file in each directory. This means two things: 48 49. You can put the name of a directory on the command line, and the 50 command will remove all files in it and its subdirectories (the 51 directories themselves are never removed from the working tree); 52 53. Giving the name of a file that is not in the index does not 54 remove that file. 55 56 57EXAMPLES 58-------- 59git-rm Documentation/\\*.txt:: 60 61 Removes all `\*.txt` files from the index that are under the 62 `Documentation` directory and any of its subdirectories. The 63 files are not removed from the working tree. 64+ 65Note that the asterisk `\*` is quoted from the shell in this 66example; this lets the command include the files from 67subdirectories of `Documentation/` directory. 68 69git-rm -f git-*.sh:: 70 71 Remove all git-*.sh scripts that are in the index. The files 72 are removed from the index, and (because of the -f option), 73 from the working tree as well. Because this example lets the 74 shell expand the asterisk (i.e. you are listing the files 75 explicitly), it does not remove `subdir/git-foo.sh`. 76 77See Also 78-------- 79gitlink:git-add[1] 80 81Author 82------ 83Written by Linus Torvalds <torvalds@osdl.org> 84 85Documentation 86-------------- 87Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>. 88 89GIT 90--- 91Part of the gitlink:git[7] suite 92