Search code examples
gitmingw32git-reset

Why am I getting error "fatal: 'C:/Program Files (x86)/Git' is outside the repository" when I run "git reset --hard ~1" from within the repository?


I'm running SourceTree on Windows 7 and when I open the MINGW32 command prompt from within the respository folder (at C:\DEV\Shayne\Quarks) and try to delete the last commit by entering the command git reset --hard ~1 I get the error fatal: 'C:/Program Files (x86)/Git' is outside the repository. The title bar of the command prompt reads MINGW32:c/DEV/Shayne/Quarks. I can't find any answers on Google and I've successfully run this command on this machine in the recent past. What is causing this error and how can I fix it?


Solution

  • You are typing a bad command. You want to type

    git reset --hard head~1
    

    I have no idea why git reports this error when you type just ~1, but it does.

    Update:

    This appears to happen because of tilde expansion.