命令格式

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. POJ 2777 Count Color (线段树成段更新+二进制思维)

    题目链接:http://poj.org/problem?id=2777 题意是有L个单位长的画板,T种颜色,O个操作.画板初始化为颜色1.操作C讲l到r单位之间的颜色变为c,操作P查询l到r单位之间的 ...

  2. js两种创建对象方式

    js创建方法的两种方式 <%@ page language="java" contentType="text/html; charset=ISO-8859-1&qu ...

  3. sql的存储过程调用

    USE [ChangHong_612]GO/****** Object: StoredProcedure [dbo].[st_MES_GetCodeRule] Script Date: 09/10/2 ...

  4. 数据库连接字符串ConnectionString 中的关键字值释义

    ConnectionString 类似于 OLE DB 连接字符串,但并不相同.与 OLE DB 或 ADO不同,如果“Persist Security Info ”值设置为false(默认值),则返 ...

  5. IE取消访问剪贴板设置

    1. 启动IE. 2. Internet选项. 3. “安全”选项卡. 4. 自定义级别. 5. “安全设置-Internet区域”->脚本->允许对剪贴板进行编程访问(启用)

  6. 来自JavaScript Garden摘取

    1.数字类型不能用作对象,因为javascript解析器会将点号(.)解析成浮点型(as a floating point literal),比如:2.toString();会导致语法从错误,解决方法 ...

  7. servler--请求重定向

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletExcepti ...

  8. Python3爬取中文网址

    本以为Python3的中文兼容性无比友好,结果还是会有一点问题的. 解决方案如下,就以爬取我自己的一个网页极简翻译为例 #coding:utf8 import urllib.request impor ...

  9. 一,彻底理解第一个C语言程序 Hello World

    对于初学者来说,第一个程序一般都是hello world,而且是照着书上一点一点敲的.所以,在初学者眼中,敲出来的第一个程序代码不过是一堆看不懂的英语.而事实上,C语言作为一门语言,是有语法的.所以这 ...

  10. contiki makefile框架分析 < contiki学习之一 >

    在linux下的工程编译,基本都可以使用makefile这个工具来完成.Contiki OS亦如此,下面分析contiki整个Makefile的框架,对makefile的具体内容暂不做分析.本文依赖于 ...