Can not remove one auto

This sound basic question and duplicate of Remove local Git changes most likely. However, I did try many option but could not get a clean slate. I am heading to create a new branch but I get error:

> error: Your local changes to the following files would be overwritten
> by checkout:
>        js/us-states.xml 
> Please, commit your changes or stash them before you can switch branches. Aborting

Since I have not modified this file (it got automatically modified) I need to discard the changes. Seems like it shown modified due to LF-CRLF conversion. I am on Windows machine.

I tried:

  • git checkout .
  • git clean -f
  • git reset --hard
  • git stash -u
  • git gui > Revert changes
  • But no matter what command I run, as soon as I run git status it show me this output:

    D:GitHubProject>git status On branch master Your branch is up-to-date with 'origin/master'.

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

        modified:   js/us-states.xml
    

    no changes added to commit (use "git add" and/or "git commit -a")

    I am getting into such issues frequently now a days. One or the other way I solve it but like to know what's going on and is there a permanent solution for this issue.

    Why it does not let me discard the changes for this file?

    Update 1:

    As a work around, I committed the change (not pushed) to get a clean slate as desired when I run git status. I was able to switch to another branch. Later I ran

    git reset --hard origin/master

    this in effect, removed temp local commit.

    链接地址: http://www.djcxy.com/p/49262.html

    上一篇: 切换分支后Filetree不刷新

    下一篇: 无法删除一个自动