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

对文件进行修改后,想要撤销修改,可以使用 git checkout . 【注意最后的点号】

 

本来要对目录执行 git stash 对修改进行压栈,却错误地顺手写成了 git stash pop,把之前未知的修改弹出了

此时,可以使用 git reset HEAD filename 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 @   算法阿杰  阅读(3273)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示