I just want to return to a clean working directory, exactly the same as after my last commit. Git tells me to download file changes that I did not make, so I suspect this is due to the end of the line.
I tried all the usual suspects to do this:
git reset --hard git commit -- . git stash git clean -fd
No matter what I do, git status always shows the same files as the changed ones. What can I do? I have uncommitted changes hidden in another branch, so I donโt just want to destroy everything, but just โroll backโ my master branch.
EDIT: Exit
$ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: demo/index.html # modified: demo/js/app.js # modified: demo/js/libs/jquery.1.7.1.js # modified: demo/js/libs/matchMedia.js # modified: demo/js/libs/modernizr.js # modified: demo/js/loadr.js # modified: dist/enquire.js # modified: src/include/intro.js # no changes added to commit (use "git add" and/or "git commit -a")
Then I try what is offered and everything else that I could find:
WickyNilliams at Nick MBA in ~/Repositories/enquire on master* $ git checkout -- . WickyNilliams at Nick MBA in ~/Repositories/enquire on master* $ git reset --hard HEAD is now at d70fee4 added meta tag to test demo on mobile #10 WickyNilliams at Nick MBA in ~/Repositories/enquire on master* $ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: demo/index.html # modified: demo/js/app.js # modified: demo/js/libs/jquery.1.7.1.js # modified: demo/js/libs/matchMedia.js # modified: demo/js/libs/modernizr.js # modified: demo/js/loadr.js # modified: dist/enquire.js # modified: src/include/intro.js # no changes added to commit (use "git add" and/or "git commit -a")
As you can see, no change, despite the rollback.
So, I followed the advice and ran diff, ignoring the whole space, and it is believed that there seems to be no difference when ignoring spaces - so I think these were line endings! What can I do to fix this? I set autocrlf to true no avail.
source share