對文件進行修改后,想要撤銷修改,可以使用 git checkout . 【注意最后的點號】
本來要對目錄執行 git stash 對修改進行壓棧,卻錯誤地順手寫成了 git stash pop,把之前未知的修改彈出了
此時,可以使用 git reset HEAD filename
git status On branch develop Your branch is up-to-date with 'origin/develop'. Unmerged paths: (use "git reset HEAD <file>..." to unstage) (use "git add <file>..." to mark resolution) both modified: package-lock.json Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: src/components/DataQueryTable/DataQueryTableF.js modified: src/main/axios.js modified: src/pages/DataQuery/DataQueryF.js modified: src/pages/DataQuery/DataQueryV.js modified: src/redux/constant.js modified: src/redux/reducers/index.js Untracked files: (use "git add <file>..." to include in what will be committed) src/redux/actions/dataquery.js src/redux/reducers/dataQuery.js no changes added to commit (use "git add" and/or "git commit -a") [tlt-p019#10020]/home/zhangjie/work/fe32_fe: git reset HEAD package-lock.json Unstaged changes after reset: M src/components/DataQueryTable/DataQueryTableF.js M src/main/axios.js M src/pages/DataQuery/DataQueryF.js M src/pages/DataQuery/DataQueryV.js M src/redux/constant.js M src/redux/reducers/index.js