git reset --hard not work

When using git to switch branches, it reminds me that there are changes locally, prepare to reset and then switch branches:

git reset --hard
git status

But did not get the desired result:

image-20200317114244356

It still prompts that a file has been modified, which is very strange. reset --hardIt is originally a recovery that does not retain the file modification.

Googled it: Unstaged changes left after git reset --hard - Stack Overflow

It is said that it is .gitattributesrelated to the file, so according to the instructions, first delete and then reset:

image-20200317114642802

Here for the record.

Guess you like

Origin blog.csdn.net/DevWiki/article/details/104918542