为什么老师的提交的提示都是git commit --<file>,而我是git restore <file>
Topic source我的也是,然后我特地测试了一下
git restore <file>
git checkout -- <file>
这两个命令起到的效果都一样的,没提交时,将文件修改撤销
其他的还不知道,等弄明白再处理
文章看完了,然后在回退未add到暂存区的文件时直接用
git restore <file>
git checkout --<file>
效果一样
当回退暂存区时(此时文件已经add到暂存区,还未进行commit),使用
git restore --staged <file>
git reset HEAD <file>
效果一样
- 1
烁靥619
Administrator@LW-20200507VEDB MINGW64 /g/hdl (master)
$ git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: world.txt
no changes added to commit (use "git add" and/or "git commit -a")