命令格式

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

Git CMD - rm: Remove files from the working tree and from the index的更多相关文章

  1. Git CMD - checkout: Switch branches or restore working tree files

    命令格式 git checkout [-q] [-f] [-m] [<branch>] git checkout [-q] [-f] [-m] --detach [<branch&g ...

  2. [Practical Git] Remove unnecessary git tracking with .gitignore files

    Most projects have automatically generated files or folders from the operating system, applications, ...

  3. git checkout 提示 “error: The following untracked working tree files would be overwritten by checkout” 解决

    问题描述 Windows 或者 macOS 操作系统中,文件名是不区分大小写的.对于已经提交到仓库中的文件修改文件名的大小写,然后又用 git rm 命令将老文件从 Git 仓库删除掉,并保存下新的文 ...

  4. Git操作删除 untracked files

    最近使用git 管理项目的时候,编译过程中出现了很多中间文件,今天发现使用 git clean 命令可以很方便进行清除: # 删除 untracked files git clean -f # 连 u ...

  5. Git CMD连接,管理(remote,add,commit,push)github repository

    git initmd testcd testgit statusgit add test  //git add test/a.txtgit status git remote add origin g ...

  6. npm run eject 命令后出现This git repository has untracked files or uncommitted changes错误

    npm run eject 暴露隐藏的文件,不可逆 结果出现下面的问题 This git repository has untracked files or uncommitted changes: ...

  7. Git GUI,Git Bash,Git CMD之间的区别

    Git GUI,Git Bash,Git CMD之间的区别 Git Bash: Bash,Unix shell的一种,Linux与Mac OS X v10.4都将它作为默认shell.Git Bash ...

  8. git之删除untrack files

    退回版本 git reset --hard commit_id //不保留未提交的修改 git reset --soft commit_id //默认方式,保留未提交的修改 撤除本地没有提交的修改 g ...

  9. [MST] Remove Model Instances from the Tree

    In this lesson we will dive a bit more into the tree semantics of MST. In this lesson you will learn ...

随机推荐

  1. 亲和串(HDU2203)

    http://acm.hdu.edu.cn/showproblem.php?pid=2203 题目意思很简单,求s1串所构成的环中是否有s2这个串 用CMP参考http://s.acmore.net/ ...

  2. 又遇BUG-ORA-01148:数据文件忽然变为recover状态

    现象: RAC环境,数据文件状态变为recover,查看alert日志有如下报错: Wed Jun 26 02:31:03 2013 Thread 1 advanced to log sequence ...

  3. Windows 8 之 windbg 配置

    怎么安装windbg? 在Win8中,要通过安装windows 8 SDK来安装. 安装之后,在C:\Program Files (x86)\Windows Kits\8.0\Debuggers\x6 ...

  4. 位运算&字节运算

  5. Thinkphp框架----微信公众测试号开发

    最开始的一个步骤.注册一个微信公众测试号.URL:https://mp.weixin.qq.com/debug/cgi-bin/sandbox?t=sandbox/login; 接口配置的信息,对新手 ...

  6. PostgreSQL的 initdb 源代码分析之二

    继续分析 下面这一段,当 initdb --version 或者  initdb --help 才有意义. ) { ], || strcmp(argv[], ) { usage(progname); ...

  7. Web项目的三层架构和MVC架构异同

    http://www.cnblogs.com/zhhh/archive/2011/06/10/2077519.html 又看到有人在问三层架构和MVC的关系,感觉这种问题有点教条化了.因为它们都在逻辑 ...

  8. python的一些总结1

    1.安装环境 window用户下载 python :https://www.python.org/downloads/release/python-2710/ 安装不解释.. 配置环境变量  找到 P ...

  9. GLSL实现简单硬件Anisotrop Lighting 【转】

    http://blog.csdn.net/a3070173/archive/2008/11/13/3294660.aspx 各向异性光照往往用于处理一些具有各向异性表面的物体,如:光盘的盘面.为避免在 ...

  10. 教你使用Android SDK布局优化工具layoutopt

    创建好看的Android布局是个不小的挑战,当你花了数小时调整好它们适应多种设备后,你通常不想再重新调整,但笨重的嵌套布局效率往往非常低下,幸运的是,在Android SDK中有一个工具可以帮助你优化 ...