操作命令:git取消修改和取消stash pop

对文件进行修改后,想要撤销修改,可以使用 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

  

posted @ 2022-02-26 16:41  算法阿杰  阅读(3517)  评论(0)    收藏  举报