05.git撤销修改

来源:互联网 发布:中信建投软件下载 编辑:程序博客网 时间:2024/05/21 06:30
1. 在second.txt添加以后内容。2. 

$ git status
On branch master
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
modified: second.txt
no changes added to commit (use “git add” and/or “git commit -a”)

3. 看到文件在工作区被修改了4. 看提示 使用git checkout -- <file> 可以撤销修改5. 

$ git checkout – second.txt

6. cat second.txt 7. 工作区修改的文本被撤销
0 0
原创粉丝点击