其他分享
首页 > 其他分享> > 【Git】撤回本地commit的某个文件的修改

【Git】撤回本地commit的某个文件的修改

作者:互联网

首先,这是我们本地待commit的文件修改

Changes to be committed:
        modified:   DataVisualization/ops.py
        modified:   VulnManage/views/views.py
        modified:   issue/service/issue_ops.py
        deleted:    static/incident/static/css/chunk-60819160.ff8eaccb.css
        new file:   static/incident/static/css/chunk-6b433ca8.11e3ddec.css
        renamed:    static/incident/static/js/app.63381f50.js -> static/incident/static/js/app.c942f567.js
        deleted:    static/incident/static/js/chunk-60819160.eef551a1.js
        new file:   static/incident/static/js/chunk-6b433ca8.d7841b5f.js
        modified:   templates/incident/index.html

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        time_task/workspace_soc_sec.code-workspace

此时 我们想撤回对文件VulnManage/views/views.py的修改

执行命令

$ git rm --cached VulnManage/views/views.py

这是我们再查看一下本地待提交的修改

Changes to be committed:
        modified:   DataVisualization/ops.py
        deleted:    VulnManage/views/views.py
        modified:   issue/service/issue_ops.py
        deleted:    static/incident/static/css/chunk-60819160.ff8eaccb.css
        new file:   static/incident/static/css/chunk-6b433ca8.11e3ddec.css
        renamed:    static/incident/static/js/app.63381f50.js -> static/incident/static/js/app.c942f567.js
        deleted:    static/incident/static/js/chunk-60819160.eef551a1.js
        new file:   static/incident/static/js/chunk-6b433ca8.d7841b5f.js
        modified:   templates/incident/index.html

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        VulnManage/views/views.py
        time_task/workspace_soc_sec.code-workspace

我们发现此时VulnManage/views/views.py的修改已经撤回

标签:Git,views,chunk,py,js,撤回,incident,static,commit
来源: https://www.cnblogs.com/WangGuangYuan/p/16354666.html