命令格式

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. jQuery弹性滑动导航菜单实现思路及代码

    <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8" /> <meta na ...

  2. 介绍50个 WordPress 动作挂钩

    WordPress 之所以能成为世界上最受欢迎的网页内容管理系统,原因就在于它的高度灵活性和可塑性,而这种灵活性和可塑性正是由“挂钩”(Hooks)简洁宜用的结构所决定的.可以说,没有过滤挂钩(Fil ...

  3. UML图示

    来源: http://www.uml.org.cn/oobject/200901041.asp 近些天学习设计.由于没有具体项目,原有项目也没有什么设计的概念,只是看相关的书籍,所以着实有些抓狂.然最 ...

  4. J2EE程序员应该要掌握的linux知识

    J2EE程序员应该要掌握的linux知识 大型J2EE应用都在建构在linux环境下的.开发环境下我们可以通过samba映射成本地的网络驱动器,直接在windows环境下进行编程调试.但是最后的发布还 ...

  5. 【转】Ruby入门教程(一)

    1. Ruby环境搭建 在Windows下,搭建Ruby环境,比较简单的方法是在“RubyInstaller”上下载一个合适的版本(D瓜哥使用的是最新版),直接安装就可以了. 另外,吐槽两句,网上有人 ...

  6. C#中判断空字符串的3种方法性能分析

    3种方法分别是:string a="";1.if(a=="")2.if(a==String.Empty)3.if(a.Length==0) 3种方法都是等效的, ...

  7. delphi 文件或目录转换成 TreeView

    //文件或目录转换成 TreeViewprocedure DirToTreeView(Tree: TTreeView; Directory: string; Root: TTreeNode; Incl ...

  8. mysql-锁表机制分析(转)

    为了给高并发情况下的mysql进行更好的优化,有必要了解一下mysql查询更新时的锁表机制.一.概述MySQL有三种锁的级别:页级.表级.行级.MyISAM和MEMORY存储引擎采用的是表级锁(tab ...

  9. php中常用设置

    设置SESSION的生命周期 今天我所要想解决的问题,简单来说,就是设置SESSION的生命周期问题,其实问题是很简单了,只是不知道为什么,我用session_cache_expire(12*60); ...

  10. Spirng_Batch

    一.需求分析 使用Spring Batch对XML文件进行读写操作: 从一个xml文件中读取商品信息, 经过简单的处理, 写入另外一个xml文件中. 二.代码实现 1. 代码结构图: 2. appli ...