bash环境GIT仓库基本操作(2)
2017-01-09 21:55
369 查看
1、丢弃工作区的修改
例:
2、撤消暂存区的修改到工作区
3、从版本库中删除文件
4、用版本库里的版本替换工作区里的版本
$ git checkout -- file //三个过程,工作区修改文件---添加文件到暂存区---提交文件到版本库。此过程类似于编辑环境下的撤销到上一次的添加或者提交的状态
例:
$ git checkout -- readme.txt
2、撤消暂存区的修改到工作区
$ git reset HEAD readme.txt Unstaged changes after reset: M readme.txt
3、从版本库中删除文件
$ git rm test.txt rm 'test.txt' $ git commit -m "remove test.txt" [master d17efd8] remove test.txt 1 file changed, 1 deletion(-) delete mode 100644 test.txt
4、用版本库里的版本替换工作区里的版本
$ git checkout -- test.txt
相关文章推荐
- bash环境GIT仓库基本操作(1)
- IDEA环境下GIT操作浅析之一Idea下仓库初始化与文件提交涉及到的基本命令
- git仓库的基本操作
- Android入门教程九之Git使用教程之本地仓库的基本操作
- Git使用教程之本地仓库的基本操作
- Git使用本地仓库之基本操作
- Git学习笔记(5)----基本操作及命令(远程仓库篇)
- Git使用本地仓库之基本操作--版本回退,后悔怎么办,撤销未提交的修改
- Git使用本地仓库之基本操作
- GitBash基本操作
- Android基础入门教程——1.5.1 Git使用教程之本地仓库的基本操作
- Git基础篇之远程仓库的基本操作以及如何给github的ReadMe文件添加图片
- git 的使用——基本的仓库创建,文件提交,上传操作命令,远程仓库关联
- Git使用本地仓库之基本操作
- git——远程仓库基本操作与冲突解决
- GitHub入门与实践(四)——Git的基本操作从初始化仓库到确认提交是否成功
- 31.开源项目--git远程仓库的基本操作
- GIT远程仓库基本操作(1)
- Git使用本地仓库之基本操作
- Git最佳实践-本地仓库基本操作