命令格式

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. CodeForces 706A Beru-taxi (数学计算,水题)

    题意:给定一个固定位置,和 n 个点及移动速度,问你这些点最快到固定点的时间. 析:一个一个的算距离,然后算时间. 代码如下: #pragma comment(linker, "/STACK ...

  2. Serializable 序列化使用限制

    序列化不能跨语言 如果单纯为了传数据,完全可以被json代替.

  3. c++出错记录

    错误1如下:  vector<vector<int>> m_vc;  error: '&' cannot appear in a constant-expression ...

  4. [Ruby01]Class, Module, Object,Kernel的关系

    puts Class.ancestorsputs '11111111111111111111'puts Module.ancestorsputs '2222222222222222222'puts O ...

  5. SSL协议与数字证书原理

    国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html 内部邀请码:C8E245J (不写邀请码,没有现金送) 国 ...

  6. Codeforces Round #326 (Div. 2) C. Duff and Weight Lifting 水题

    C. Duff and Weight Lifting Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest ...

  7. Android系统Recovery工作原理之使用update.zip升级过程分析(一)

    通过分析update.zip包在具体Android系统升级的过程,来理解Android系统中Recovery模式服务的工作原理.我们先从update.zip包的制作开始,然后是Android系统的启动 ...

  8. Android Configuration change属性

    问题:横竖屏切换时Activity的生命周期? 答案: 1.不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次 2 ...

  9. C++函数的传入参数是指针的指针(**)的详解

    要修改变量的值,需要使用变量类型的指针作为参数或者变量的引用.如果变量是一般类型的变量,例如int,则需要使用int 类型的指针类型int *作为参数或者int的引用类型int&.但是如果变量 ...

  10. 思科(Cisco)路由器策略路由配置详解

    策略路由是路由优化的常用方法.在做路由牵引时很多情况都要用到策略路由.我刚刚接触思科这东西,对策略路由的配置还不太熟悉,今天终于配好了,记录一下. 网络拓扑 R2的E1\E2口分别与R3的E1\E2口 ...