Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8665083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:23:50+00:00 2026-06-12T17:23:50+00:00

I just want to get back to a clean working directory, exactly as it

  • 0

I just want to get back to a clean working directory, exactly as it was after my last commit. Git is reporting to me a load of file modifications that I haven’t made, so I suspect it’s something to do with line endings.

I have 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 having been modified. What can I do? I have uncommitted changes stashed in another branch so I don’t want to just blast away everything, but rather just “roll back” my master branch.

EDIT: Output

$ 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 suggested and everything else 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 changes despite the rollback.

So then I followed advice and ran a diff ignoring all space, and as suspected it seems there’s no differences when ignoring spaces – so i guess it was line endings! What can I do to fix this? I’ve set to autocrlf to true to no avail.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:23:51+00:00Added an answer on June 12, 2026 at 5:23 pm

    If you want to just change a file back to the way it was after the last commit, just do a git checkout [file] to get a particular file. But a git reset --hard should have done that to the whole tree. If you think it’s just the line-endings, do a git diff and then a git diff --ignore-all-space. If the first diff shows changes and the second one doesn’t, then at least you know you have a line-ending problem, in which case you might want to look at this description of git and line endings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get rid of everything I did since my last commit, including
I've just saved an arraylist to a file. Now I want to load it
I just want get a 2 dimension array of List in c#. In my
I just want to get a selector name, and the arguments, sender, or an
I just want to get a quick htaccess redirection. ie: domain.com/subfolderGreen --> domain.com/index.php?folder=subfolderGreen (note
I just want to get the System IP address and display it on a
I just want to get numbers of times to be used for each Activity.
I just want to get email id of user having phone number given. so
I just want to get the total days in a list of dates. Here
Say you just want to get rid of the changes you've made to one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.