Git CMD - rm: Remove files from the working tree and from the index

命令格式

git rm [-f | --force] [-n] [-r] [--cached] [--ignore-unmatch] [--quiet] [--] <file>…​

 

命令参数

-f, --force
  强制删除。

-r
  递归删除目录及其内容。

-- cached
  从暂存区移除文件,不再跟踪文件,工作区的文件仍保留下来。

-q, --quit
  安静模式。

 

实例

a) 从工作区和暂存区将文件移除。

$ git rm testfile.txt

b) 从工作区和暂存区将目录移除。

$ git rm -rf src/

c) 从暂存区移除文件,不再跟踪文件,工作区的文件仍保留下来。

$ git rm --cached testfile.txt

 

posted on 2015-12-30 19:16  huey2672  阅读(400)  评论(0编辑  收藏  举报