Why won't “git reset HEAD” undo my uncommitted, unstaged changes?

后端 未结 6 1494
失恋的感觉
失恋的感觉 2021-02-05 09:30

I\'ve previously been able to undo changes through SourceTree by performing the \"Discard\" function, which under the hood produces this command:

git -c diff.mne         


        
6条回答
  •  臣服心动
    2021-02-05 09:49

    I just got stuck in this situation and the only thing which fixed it was the following:

    git log
    

    Find the first commit in the repo and get the hash (in my case started with fdb14f)

    Note: This only works because the repo with the issue was on a Linux server while I had a remote repo "origin" on my Windows box that contained the most recent commit which fixed the CRLF issue.

    git reset --hard fdb14f
    git pull origin master
    

    After trying all kinds of different things this is what finally allowed me to get around the issue. I had fixed the CRLF issue in the most recent commit, but nothing else I tried would allow me to get around these files.

提交回复
热议问题