git rm与直接rm的区别
git rm
行为:
1.删除一个文件
2.将被删除的这个文件纳入缓存区
$ git rm a
rm 'a'
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage) deleted: a
提交:
直接 git commit -m ''
$ git commit -m 'delete a'
[master 1cd6efe] delete a
file changed, insertions(+), deletions(-)
delete mode a $ git status
On branch master
nothing to commit, working directory clean
恢复:
1. 恢复暂存区
2. 恢复工作区
$ git reset HEAD a
Unstaged changes after reset:
D a $ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory) deleted: a no changes added to commit (use "git add" and/or "git commit -a") $ git checkout -- a
$ git status
On branch master
nothing to commit, working directory clean
直接调用系统的rm
行为:
从工作区删除了一个文件
$ rm a $ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory) deleted: a no changes added to commit (use "git add" and/or "git commit -a")
提交:
1.把修改加入暂存区
2.提交暂存区的改动
$ git add a $ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage) deleted: a $ git commit -m 'delete a '
[master 689a73d] delete a
file changed, insertions(+), deletions(-)
delete mode a $ git status
On branch master
nothing to commit, working directory clean
恢复:
直接恢复工作区就好了,git checout -- file
$ git checkout -- a $ git status
On branch master
nothing to commit, working directory clean
git rm与直接rm的区别的更多相关文章
- [git] 细说commit (git add/commit/diff/rm/reset 以及 index 的概念)
http://kasicass.blog.163.com/blog/static/39561920133294219374/ 创建测试仓库 $ git init $ echo "line o ...
- git mv与直接mv的区别
git mv 行为: 1.创建一个和之前文件内容一样的文件,文件名为新的文件名 2.将原来的文件删除 3.将删除的文件添加到暂存区 4.将新建的文件添加到暂存区 $ git mv a a1 $ git ...
- [rm] Linux 防止"rm -rf /" 误删除
一.缘由: 最近看到这则新闻,很是悲伤,因为我最近也在用ansible:然而这一错误源自Ansible上糟糕的代码设计,这款Linux实用工具被用于在多台不同服务器上自动执行脚本. 开发者解释到,实际 ...
- git database 数据库 平面文件 Git 同其他系统的重要区别 Git 只关心文件数据的整体是否发生变化,而大多数其他系统则只关心文件内容的具体差异 Git 的设计哲学
小结: 1.如果要浏览项目的历史更新摘要,Git 不用跑到外面的服务器上去取数据回来 2.注意 git clone 应指定版本,它复制的这个版本的全部历史信息: 各个分支 git init 数据库 ...
- gitLab的使用 和 git 、 github、gitlab的区别
一.git . github.gitlab的区别 (百度相关内容得到的理解) 二.git最基本作用:版本控制 三.有集成了git的GIT安装包 github和gitlab都使用git该版 ...
- 关于linux shell编程,alias rm='cp $@ ~/backup; rm $@'
书上的这个例子需要在ubuntu的低版本的系统才支持,现在基本上都不支持了,想实现也很简单自己写一个脚本先备份再删除. alias也只是做了一次替换alias rm='cp $@ ~/backup; ...
- 关于git和SVN的介绍和区别
主要对git,svn进行一个简单的介绍. 顺带,我会在后面把我整理的一整套CSS3,PHP,MYSQL的开发的笔记打包放到百度云,有需要可以直接去百度云下载,这样以后你们开发就可以直接翻笔记不用百度搜 ...
- git 常用命令 mv rm checkout revert reset
关于上节讲的git add 时需要添加注释信息,也可以在git commit时再添加 laoni@DESKTOP-TPPLHIB MINGW64 /c/laoni/PycharmProjects/gi ...
- git和其他版本控制系统的区别
所有除了Git以外的版本控制系统都使用增量存储方式来保存不同版本,而Git则在每一个commit时,保存一个整个文件的content copy,除非那个文件没有做过改动.Git和其他版本系统的主要区别 ...
随机推荐
- PHP学习笔记(10)mysql常用命令
1. 连接mysql数据库: 输入: mysql> mysql -uroot -p123(注意后面没有分号!!) 输出: mysql: [Warning] Using a password on ...
- linux学习笔记16--命令find
find是linux系统中用的比较多的一个命令,而且功能强大,特别是对各种查找方式的不确定位置的文件的查找. Linux下find命令在目录结构中搜索文件,并执行指定的操作.Linux下find命令提 ...
- H4CK1T CTF 2016 Mexico-Remote pentest writeup
进去网站之后发现连接都是包含类型的,就能想到文件包含漏洞(话说刚总结过就能遇到这题,也算是复习啦) 这里用php://filter/read=convert.base64-encode/resourc ...
- PHP从千千静听服务器获取lrc歌词
<?php //转载请注明出处 uenucom function SingleDecToHex($dec) { $tmp=""; $dec=$dec%16; if($ ...
- C#版本的xUnit的测试框架模型和xUnit.NET开源项目
1. 参考kent beck的测试驱动写的C#测试框架模型 a) 测试用例: WasRun, 基类为TestCase b) 框架: TestCaseTest用来测试TestCase,本身也是它的子类, ...
- 去掉点击map时的显示area边框
cus="true"的属性即可 如下: <img src="some.jpg" border="0" usemap="#ma ...
- C++ namespace浅析
有一些C语言的基础,突然想看看C++,在Codeblocks上新建工程的时候会生成一个打印"Hello World"的程序,和C语言些许不同.其中最突出的就是"using ...
- 第二百一十五节,jQuery EasyUI,DateBox(日期输入框)组件
jQuery EasyUI,DateBox(日期输入框)组件 学习要点: 1.加载方式 2.属性列表 3.事件列表 4.方法列表 本节课重点了解 EasyUI 中 DateBox(日期输入框)组件的使 ...
- 第一百五十三节,封装库--JavaScript,表单验证--备注字数验证
封装库--JavaScript,表单验证--备注字数验证 效果图 html <div id="reg"> <h2 class="tuo"> ...
- Java语言中两种异常的差别
Java提供了两类主要的异常:runtime exception和checked exception.所有的checked exception是从java.lang.Exception类衍生出来的,而 ...