git
有如下三种状态:
- Modified: You have changed the file but have not committed it to your database yet.
- Staged: You have marked a modified file in its current version to go into your next commit snapshot.
- Committed: The data is safely stored in your local database.
现在主要讲述下git
的撤销操作:
discard changes in working directory
前提:<file>
已经被添加到暂存区
git restore <file>
working direction <- index
git reset HEAD <file>
index <- HEAD
git reset --soft HEAD^
working direction <- HEAD
git reset --hard HEAD^