赞
踩
我们平时工作的时候,可能会误删某个文件或者文件夹,这时候就需要把它找回
git status
查看文件状态➜ git:(test) git status
On branch test
Your branch is up to date with 'origin/test'.
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
# deleted:后面就是被删除的文件路径
deleted: README.md
no changes added to commit (use "git add" and/or "git commit -a")
git add .
添加到暂存区了,则需要先将文件/文件夹回退,反之这一步可以省略# git reset HEAD 后面接被删除的文件/文件夹路径
➜ git:(test) ✗ git reset HEAD README.md
Unstaged changes after reset:
D README.md
# git checkout 后面接被删除的文件/文件夹路径
➜ git:(test) ✗ git checkout README.md
Updated 1 path from the index
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。