加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Unstaged changes left after git reset --hard

发布时间:2020-12-14 16:37:38 所属栏目:百科 来源:网络整理
导读:一.问题描述 工作空间有两个文件,覆盖不掉。git reset --hard,git checkout -- file 都覆盖不掉。 $ git status On branch branch_NO17 Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..."

一.问题描述

工作空间有两个文件,覆盖不掉。git reset --hard,git checkout -- file 都覆盖不掉。

$ git status
On branch branch_NO17
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)

modified: xxx/js/lib/#dojo的一个路径#/gauges/xxx.js
modified: xxx/js/lib/#dojo的一个路径#/xxx.html

二.解决

1.删掉.gitattributes文件
工程内查找.gitattributes文件

$ find . -name .gitattributes
找到5个.gitattributes文件,都在js/lib包里。其中有两个在上述两个文件的上层目录。就删掉这个目录下的.gitattributes

$ git rm xxx/js/lib/#dojo的一个路径#/.gitattributes

2.将工作区所有添加到缓存区(包括对.gitattributes的删除)

$ git add -A

3.强制覆盖缓存区和工作区

$ git reset --hard

4.查看工作区和暂存区的状态

$ git status
On branch branch_NO17
nothing to commit,working directory clean
世界安静了,尽情享受吧!

参考:

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读