您的位置:首页 > 运维架构 > Shell

bash环境GIT仓库基本操作(2)

2017-01-09 21:55 369 查看
1、丢弃工作区的修改

$ 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  git